Hi All,
I'm new to DB2 stored procedures. I'm trying to create a temporary table, then select data into it from number of different tables, than return result as a ResultSet into Java application.
Here is the procedure, it's jut a draft. But it doesn't compile. Without Declare temporary table statement it works. But after I declare MYTEMP table procedure gives me an error during compilation. It's complaining about cursor.
I'm I doing somethign wrong ?
CREATE PROCEDURE ROMAN.TEST ( INOUT PARAMETER1 INTEGER )
RESULT SETS 0
LANGUAGE SQL
SPECIFIC ROMAN.TEST
BEGIN
DECLARE VARIABLE1 DECIMAL ( 5 , 4 ) ;
DECLARE GLOBAL TEMPORARY TABLE MYTEMP LIKE CAC ;
DECLARE cursor1 CURSOR FOR
SELECT CACB#, CACID, CACX#, CACDAT, CACTIM, CACBDT, CACSTS, CACCDT, CACCTM, CACTST, CACCME, CACCMD, CACCMT, CACPME, CACPMD, CACPMT FROM CAC ;
-- Cursor left open for client application
OPEN cursor1;
END
Thanks,
Roman Pr.
I'm new to DB2 stored procedures. I'm trying to create a temporary table, then select data into it from number of different tables, than return result as a ResultSet into Java application.
Here is the procedure, it's jut a draft. But it doesn't compile. Without Declare temporary table statement it works. But after I declare MYTEMP table procedure gives me an error during compilation. It's complaining about cursor.
I'm I doing somethign wrong ?
CREATE PROCEDURE ROMAN.TEST ( INOUT PARAMETER1 INTEGER )
RESULT SETS 0
LANGUAGE SQL
SPECIFIC ROMAN.TEST
BEGIN
DECLARE VARIABLE1 DECIMAL ( 5 , 4 ) ;
DECLARE GLOBAL TEMPORARY TABLE MYTEMP LIKE CAC ;
DECLARE cursor1 CURSOR FOR
SELECT CACB#, CACID, CACX#, CACDAT, CACTIM, CACBDT, CACSTS, CACCDT, CACCTM, CACTST, CACCME, CACCMD, CACCMT, CACPME, CACPMD, CACPMT FROM CAC ;
-- Cursor left open for client application
OPEN cursor1;
END
Thanks,
Roman Pr.