Hi,
I create a procedure in which I have a global temprary table and a cursor to select information from this table but I received error that I can't declare the cursor. Why?
My proc is like this
create procedure test()
DYNAMIC RESULT SETS 1
LANGUAGE SQL
BEGIN
DECLARE GLOBAL TEMPORARY TABLE SESSION.tmpaccref
(num integer,EmpName varchar(30))
WITH REPLACE
ON COMMIT PRESERVE ROWS
NOT LOGGED;
DECLARE temp_cursor CURSOR WITH HOLD WITH RETURN TO CLIENT FOR
select * from SESSION.tmpaccref;
INSERT INTO session.tmpaccref(
SELECT a,b
FROM x_table);
updatex_table set a='222' when a is null;
open temp_curosr;
end
I create a procedure in which I have a global temprary table and a cursor to select information from this table but I received error that I can't declare the cursor. Why?
My proc is like this
create procedure test()
DYNAMIC RESULT SETS 1
LANGUAGE SQL
BEGIN
DECLARE GLOBAL TEMPORARY TABLE SESSION.tmpaccref
(num integer,EmpName varchar(30))
WITH REPLACE
ON COMMIT PRESERVE ROWS
NOT LOGGED;
DECLARE temp_cursor CURSOR WITH HOLD WITH RETURN TO CLIENT FOR
select * from SESSION.tmpaccref;
INSERT INTO session.tmpaccref(
SELECT a,b
FROM x_table);
updatex_table set a='222' when a is null;
open temp_curosr;
end