Could someone please explain why one of the insert statements below works and the other one using variables does not? I'm using db2 udb 8.2.
Thanks
DECLARE GLOBAL TEMPORARY TABLE session.outputtbl
(TradeId CHAR(20)
, Quantity DEC(28,3)
, Mark DEC(28,3)
, MarketValue DEC(28,3)
)
ON COMMIT PRESERVE ROWS
;
DECLARE trd_ticket CHAR(20) DEFAULT 'abc';
DECLARE trd_pos DEC(28,3) DEFAULT 0;
DECLARE trd_mark DEC(28,3) DEFAULT 0;
DECLARE trd_amount DEC(28,3) DEFAULT 0;
INSERT INTO session.outputtbl VALUES('001', 0, 0, 0); --WORKS
INSERT INTO session.outputtbl VALUES(trd_ticket, trd_pos, trd_mark, trd_amount); -- DOES NOT WORK
commit;
SELECT * FROM session.outputtbl;