I'm trying to write a simple insert into statement using multiple values. The solutions I've seen say to separate each set of values with a comma, however, I am still being met with an error. Here is my SQL statement.
INSERT INTO DIVISION (DIVISION_ID, DIVISION_NAME)
VALUES ('20', 'Quebec'), ('30', 'Ontario');
You can also use this one:
INSERT ALL
INTO DIVISION (DIVISION_ID, DIVISION_NAME) VALUES (20, 'Quebec')
INTO DIVISION (DIVISION_ID, DIVISION_NAME) VALUES (30, 'Ontario')
SELECT * FROM dual;
If DIVISION_ID is a numeric data type:
INSERT INTO DIVISION (DIVISION_ID, DIVISION_NAME)
SELECT 20, 'Quebec' FROM DUAL
UNION ALL
SELECT 30, 'Ontario' FROM DUAL;
Otherwise:
INSERT INTO DIVISION (DIVISION_ID, DIVISION_NAME)
SELECT '20', 'Quebec' FROM DUAL
UNION ALL
SELECT '30', 'Ontario' FROM DUAL;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.