Best Way to Do Multi-Row Insert in Oracle

Best way to do multi-row insert in Oracle?

This works in Oracle:

insert into pager (PAG_ID,PAG_PARENT,PAG_NAME,PAG_ACTIVE)
select 8000,0,'Multi 8000',1 from dual
union all select 8001,0,'Multi 8001',1 from dual

The thing to remember here is to use the from dual statement.

Oracle multi-row insert statement

Like this perhaps: http://www.techonthenet.com/oracle/questions/insert_rows.php

SQL INSERT INTO multiple rows

As far as I can see there is no syntax errors within my command

Actually, there is. Syntax you used is invalid, as far as Oracle is concerned.



'SQL commands' on Oracle Apex, which expects only one command at a time

Actually, no. You can run several of them, just not as SQL but PL/SQL which means that you have to enclose them into BEGIN-END block. Have a look at the screenshot:

Note, however, that not everything can be run that way. DDL would, for example, require dynamic SQL.



Related Topics



Leave a reply



Submit