Many SQL databases support what the SQL standard calls a
. Such databases include at least CUBRID, Derby, Firebird, HSQLDB, Postgres, SQL
As suggested by user tbone here, common table expressions are a good solution to my problem, at least for Oracle. For completeness, here is my example query written using CTEs in Oracle
-- Rename a to u(b) with Oracle
with u(b) as (select 1 from dual)
select u.b from u
-- Rename a to u(b) with H2, which only knows recursive CTEs
-- Thanks to a comment by user a_horse_with_no_name
with recursive u(b) as (
select 1
union all
select null where false
)
select u.b from u