The global temporary table needs to be created as follows.
CREATE GLOBAL TEMPORARY TABLE tt_java_mytable ON COMMIT PRESERVE ROWS AS
SELECT RPAD(‘ ‘, 200, ‘ ‘),t.id, t.amount from table2 t
WHERE 1=0;
The RPAD() function is used to represent the variable datatype. In our example the variable is defined as varchar(200), and RPAD to pad out the column to be 200. If the variable was defined as an int, then we would replace the RPAD() expression with 0.0:
CREATE GLOBAL TEMPORARY TABLE tt_java_mytable ON COMMIT PRESERVE ROWS AS
SELECT RPAD(0.0:),t.id, t.amount from table2 t
WHERE 1=0;
|