Hi,
I have a trigger in which I build a String from the contents of a
table. In a stored procedure I would use a cursor which would look
like:
set str_to_build = '';
create c1 cursor for
select col1 from table1;
fetch c1 into str_var1;
while SQLCODE = 0 do
set str_to_build = str_to_build || str_var1;
fetch c1 into str_var1;
end while;
I would like to do something similar in a trigger. From searching this
forum I came to understand that this can be done using Common Table
Expressions. As I am new to db2 I do not know how this is done. Any
sample code that will help me do this will be greatly appreciated.
Thanks,
Jake
I have a trigger in which I build a String from the contents of a
table. In a stored procedure I would use a cursor which would look
like:
set str_to_build = '';
create c1 cursor for
select col1 from table1;
fetch c1 into str_var1;
while SQLCODE = 0 do
set str_to_build = str_to_build || str_var1;
fetch c1 into str_var1;
end while;
I would like to do something similar in a trigger. From searching this
forum I came to understand that this can be done using Common Table
Expressions. As I am new to db2 I do not know how this is done. Any
sample code that will help me do this will be greatly appreciated.
Thanks,
Jake