If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > creating cursors within stored procedures using transition table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-14-12, 05:54
masood313 masood313 is offline
Registered User
 
Join Date: Jul 2012
Posts: 21
creating cursors within stored procedures using transition table

create or replace trigger t1
after update on emp
referencing new_table as ntable
for each row
mode db2sql
begin
declare e_name varchar(30);
declare sal integer;
declare e_comm integer;
declare cursor c1
for
select ename,salary,comm
from ntable;
open c1;
fetch c1 in e_name,sal,e_comm;
close c1;
end;

we cant create a cursor inside a trigger, so we have to create a stored procedure with cursor and call it in the trigger. pls tell me how to create a stored procedure with cursor using transition table.
i hope i am clear with the question. thanks.
Reply With Quote
  #2 (permalink)  
Old 07-14-12, 05:56
dipankar.sarma30 dipankar.sarma30 is offline
Registered User
 
Join Date: Jul 2012
Posts: 9
no you are not clear.
Reply With Quote
  #3 (permalink)  
Old 07-14-12, 19:54
papadi papadi is offline
Registered User
 
Join Date: Oct 2009
Location: 221B Baker St.
Posts: 487
Why does someone believe this is an acceptable alternative? There is a reason a cursor cannot be defined within a trigger and you are just trying to "get around" this. The cursor would still execute within the trigger, no?

If you explain what needs to happen (rather than how it is currently trying to be colved) someone may have a suggestion.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On