Discussions
Categories
- 17.9K All Categories
- 3.4K Industry Applications
- 3.3K Intelligent Advisor
- 62 Insurance
- 536K On-Premises Infrastructure
- 138.2K Analytics Software
- 38.6K Application Development Software
- 5.7K Cloud Platform
- 109.4K Database Software
- 17.5K Enterprise Manager
- 8.8K Hardware
- 71.1K Infrastructure Software
- 105.2K Integration
- 41.5K Security Software
Add support for the VALUES() constructor

Technically, an INSERT statement always transfers data from one table to another, regardless if we're using the INSERT .. VALUES syntax or the INSERT .. SELECT syntax. This is because the VALUES() constructor is in fact a standalone table according to the SQL standard. The following syntax is thus a valid query in SQL (as implemented by SQL Server and PostgreSQL):
VALUES(1), (2)
The above query can currently be emulated (quite tediously) in Oracle using:
SELECT 1 FROM dual
UNION ALL
SELECT 2 FROM dual
Of course, the syntax is not restricted to producing only one column. Here's a two-column version:
VALUES(1, 'a'),
(2, 'b')
And finally, this feature probably depends on derived column lists being available (), which is the only way to give such a table (and its columns) a name:
SELECT *
FROM (
VALUES(1, 'a'),
(2, 'b')
) t(a, b)
Now, this construct is really extremely useful when producing ad-hoc cross joins and other data with hard-coded constant tables.
This request is now referenced as: ENH 28424374 - ADD SUPPORT FOR THE ISO SQL STANDARD VALUES() CONSTRUCTOR
Comments
-
Primary usefulness for the SQL syntax seems to be:
- Generate sample data (eg this Forum)
- Initialize (or add to) a Dimension table with multiple rows.
Additionally, other software should be able to generate such syntax similar to how they can generate INSERT statements.
- SQL*Developer /*insert*/ hint.
- SQL*Developer Export Table option
- SQLcl (SET SQLFORMAT insert)