Is there a way to insert a temp table results to DB2 table, for example:
WITH TEMP1 AS ( SELECT CUSTOMER_ID FROM T_CUSTOMER WHERE CUSTOMER_ID BETWEEN 100 TO 300 ), TEMP2 AS ( SELECT CUTOMER_ID, ORDER_ID FROM TEMP1 T1 JOIN T_ORDER R1 ON T1.CUSTOMER_ID = R1.CUSTOMER_ID) SELECT CUTOMER_ID, ORDER_ID FROM TEMP2
I tried the below way, but it did not work:
INSERT * INTO T_STORAGE (CUTOMER_ID, ORDER_ID) SELECT * FROM TEMP2
I searched a lot but couldn't find any way. Only to modify my query without temp tables, but then the query will be very slow.