Skip navigation.

rnanton's blog

Oracle SQL Model - An Alternative to UNION for Creating A list of Static Values

Here’s an alternative to the union statement for creating a collection of values using the Oracle SQL Model construct in 10g.

[code]--Using SQL Model clause to return a list of items.

SELECT col_1 Product, col_2 Price, col_3 Description
FROM (SELECT -1 col_id,
RPAD ('X', 30) col_1,
TO_NUMBER(RPAD ('1', 3)) col_2,
RPAD ('X', 40) col_3
--Change RPAD number to reflect length of column value.
WHERE col_id <> -1