PostgreSQL supports the SQL spec's VALUES
expression in what the spec calls a <table value constructor>
SELECT *
FROM (VALUES
(1, 'one'),
(2, 'two'),
(3, 'three')
) AS t(num,letter);
num | letter
-----+--------
1 | one
2 | two
3 | three
(3 rows)
Trying it on dbfiddle, I can't get it to work in Oracle. I keep getting
ORA-00903: invalid table name
Does Oracle support the VALUES ( expression [, ...] )
? If not what is the alternative method of creating a virtual table from row-literals provided in the query?
Best Answer
The most concise option we've got is with
insert all
:dbfiddle here
Note that the syntax is an extension to the standard and allows inserting into multiple tables with a single statement and conditional inserts, as the example shows:
dbfiddle here