with recursive R(n) as (
values(1)
union all
select N + 1
from R
where N < 100 -- replace 100 with the number of records you want
)
select N from R
;
Dienstag, 3. Mai 2016
Sequence Generator
Let assume you need to get a specific number of records as a data source. The actual content of the records does not matter much. You can achieve this be the following query.
Quick regression test statement
WITH base_new
AS (SELECT -- TODO select column list
FROM table_with_new_data
WHERE -- TODO adapt where clause
)
, base_old
AS (SELECT -- TODO copy column list from new data table
FROM table_with_old_data
WHERE -- TODO copy where clause from new data table
)
, new
AS (SELECT 'new' AS src, t.*
FROM base_new t
MINUS
SELECT 'new' AS src, t.*
FROM base_old t)
, old
AS (SELECT 'old' AS src, t.*
FROM base_old t
MINUS
SELECT 'old' AS src, t.*
FROM base_new t)
, uni
AS (SELECT * FROM old
UNION ALL
SELECT * FROM new)
SELECT /*+ parallel(4) */
*
FROM uni
ORDER BY 2 ASC, 3 ASC, 1 ASC;
Abonnieren
Posts (Atom)