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
SQL Logic Operator Precedence: and and Or
Need to Return Two Sets of Data With Two Different Where Clauses
Is Select or Insert in a Function Prone to Race Conditions
How to Generate a Range of Numbers Between Two Numbers
Cannot Insert Explicit Value For Identity Column in Table 'Table' When Identity_Insert Is Set to Off
SQL Nvarchar and Varchar Limits
How to Return Result of a Select Inside a Function in Postgresql
Accessing an Sqlite Database in Swift
Difference Between Lateral Join and a Subquery in Postgresql
Refactor a Pl/Pgsql Function to Return the Output of Various Select Queries
Recommended SQL Database Design For Tags or Tagging
Return Row With the Max Value of One Column Per Group