How to enter multiple records in single query in sql plus

111 Views Asked by At

I have student table with 3 atributes STUDENT_ID, NAME and AGE

I'm getting this error after executing the query Query:

INSERT INTO student(STUDENT_ID, NAME, AGE) 
values
(3, 'WILSON', 40),
(4, 'ALEX', 30);

Error: ORA-00933: SQL command not properly ended

1

There are 1 best solutions below

0
Popeye On BEST ANSWER

You can use INSERT INTO .. SELECT and UNION ALL as follows:

INSERT INTO student(STUDENT_ID, NAME, AGE) 
SELECT 3, 'WILSON', 40 FROM DUAL UNION ALL
SELECT 4, 'ALEX', 30 FROM DUAL;