Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multiple row insert in Oracle SQL

I use multiple row insert syntax in oracle SQL like this:

INSERT ALL
  INTO student(ID, FIRST_NAME, LAST_NAME, AGE)  VALUES(4,'test_name','test_lname',17)
  INTO student(ID, FIRST_NAME, LAST_NAME, AGE)  VALUES(5,'test_name2','test_lname2',20)
  INTO student(ID, FIRST_NAME, LAST_NAME, AGE)  VALUES(6,'test_name3','test_lname3',21)
  select * from dual;

can anyone explain me what is the meaning of using

select * from dual

at the and of statement?

like image 806
Davit khaburdzania Avatar asked Dec 27 '22 23:12

Davit khaburdzania


1 Answers

it the syntax for INSERT ALL

INSERT ALL
INTO <table_name> VALUES <column_name_list)
INTO <table_name> VALUES <column_name_list)
...
<SELECT Statement>;

if there is nothing you want to select after inserting you do select * from dual

otherwise you do your select you want usually to confirm the insert success

reference

like image 188
shareef Avatar answered Jan 15 '23 08:01

shareef