CREATE TABLE with_source ( a INT GENERATED always AS IDENTITY , b INT );
CREATE TABLE with_target ( a INT GENERATED always AS IDENTITY , b INT );
INSERT INTO with_source ( b ) VALUES ( 1 );
REPLACE PROCEDURE with_test_proc ()
BEGIN
INSERT INTO with_target ( b )
SELECT b
FROM (
SELECT 1 b
FROM with_source ) tmp
UNION
SELECT b + 1
FROM (
SELECT 1 b
FROM with_source ) tmp ; END;
DELETE FROM with_target;
CALL with_test_proc();
SELECT * FROM with_target;
It works with derived table ..
CREATE TABLE with_source ( a INT GENERATED always AS IDENTITY , b INT );
CREATE TABLE with_target ( a INT GENERATED always AS IDENTITY , b INT );
INSERT INTO with_source ( b ) VALUES ( 1 );
REPLACE PROCEDURE with_test_proc ()
BEGIN
INSERT INTO with_target ( b )
SELECT b
FROM (
SELECT 1 b
FROM with_source ) tmp
UNION
SELECT b + 1
FROM (
SELECT 1 b
FROM with_source ) tmp ; END;
DELETE FROM with_target;
CALL with_test_proc();
SELECT * FROM with_target;