Forum Stats

  • 3,874,575 Users
  • 2,266,762 Discussions
  • 7,911,901 Comments

Discussions

More succinct SELECTs in WITH clause

In Oracle, we can store test data in the WITH clause, which is great for sharing code snippets in forums, etc.:

with data (asset_id, x, y) as (
select 100, 10, 20 from dual union all
select 200, 30, 40 from dual union all
select 300, 50, 50 from dual)
select * from data

  ASSET_ID          X          Y
---------- ---------- ----------
       100         10         20
       200         30         40
       300         50         50

db<>fiddle

With that said, there are other DBs like SQLite that have more succinct syntax, making the WITH clause easier to read and compose:

with data (asset_id, x, y) as (
  VALUES
  (100, 10, 20),
  (200, 30, 40),
  (300, 50, 50)
)  
select * from data

db<>fiddle

Could Oracle consider supporting more succinct SELECTs in the WITH clause?

User_1871
1 votes

Active · Last Updated