Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Posts
    2

    Unanswered: declaring cursors in a trigger

    Hi, I am trying to write a "FOR EACH ROW" trigger in which a cursor is declared:

    CREATE TRIGGER attrigger AFTER UPDATE ON all_type
    REFERENCING OLD AS old NEW AS new
    FOR EACH ROW MODE DB2SQL
    BEGIN ATOMIC
    DECLARE c1 CURSOR FOR SELECT s1 FROM sls;
    END

    This results in an error: "SQL0104N An unexpected token 'FOR' was found following 'DECLARE c1 CURSOR'. Expected tokens may include: '<SQL_variable_condition_declaration>'."

    Is it possible to have a cursor within the body of a "FOR EACH ROW" trigger?

    Thanks.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    No,
    See my response in a previous reply for what you can do in a trigger:

    http://dbforums.com/t669690.html

    Andy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •