I am trying to insert multiple rows into my table using the below query : INSERT INTO TABLE2(ID) VALUES(1),(2) .It is showing SQL Command Not Ended.
Is it some syntacital error?I have rechecked but still not clear what's going wrong.
I am trying to insert multiple rows into my table using the below query : INSERT INTO TABLE2(ID) VALUES(1),(2) .It is showing SQL Command Not Ended.
Is it some syntacital error?I have rechecked but still not clear what's going wrong.
Invalid syntax, of course. But, here are 3 options that work.
SQL> create table table2(id number);
Table created.
SQL>
SQL> insert into table2(id) values(1);
1 row created.
SQL> insert into table2(id) values(2);
1 row created.
SQL>
SQL> insert all
2 into table2(id) values (1)
3 into table2(id) values (2)
4 select * from dual;
2 rows created.
SQL>
SQL> insert into table2(id)
2 select 1 from dual
3 union all
4 select 2 from dual;
2 rows created.
SQL>