Home > database >  In SQL developer how to insert multiple data
In SQL developer how to insert multiple data

Time:09-26

For example, I want to a table (dept) to insert two data, must use two insert into? Only used once can insert into the net, baidu's a lot of options are the great god can do to help solve, thank you!
Insert into dept (deptno, dname, loc) values (10, 'accounting', 'New York');
Insert into dept (deptno, dname, loc) values (20, 'research', 'Dallas');

CodePudding user response:

Can use an insert statement:
 
With TMP as
(
Select deptno, dname 'accounting', 'New York' loc from dual
Union all
Select deptno, 20 'research' dname, 'Dallas' loc from dual
)
Insert into dept (deptno, dname, loc) select * from TMP.

The last remember to commit

CodePudding user response:

Upstairs principle first see the view, then select data from the view, can solve the problem of the building

CodePudding user response:

Rookie, should use habits, first batch again, multi-line write also have advantages, not one by one place wrong, seek along while don't know where is wrong!
  • Related