How to select several hardcoded SQL rows? How to select several hardcoded SQL rows? oracle oracle

How to select several hardcoded SQL rows?


Values keyword can be used as below.

select * from (values ('test-a1', 'test-a2'), ('test-b1', 'test-b2'), ('test-c1', 'test-c2')) x(col1, col2)


The following will work for SQL:

SELECT 'test-a1' AS name1, 'test-a2' AS name2 UNION ALL SELECT 'test-b1', 'test-b2'UNION ALL SELECT 'test-c1', 'test-c2'


UNION ALL is the best bet. It's faster than UNION and you will have mutually exclusive rows.