Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Posts
    2

    Unanswered: CURSOR inside PROCEDURE

    How can I do to declare a CURSOR inside a PROCEDURE ? I think I'm using a wrong syntax.

    Thanks !!!

  2. #2
    Join Date
    Nov 2003
    Location
    Mumbai, India
    Posts
    92
    Hi,

    CREATE PROCEDURE foreach_example()
    DEFINE i, j INT;
    FOREACH cur1 FOR SELECT c2, c3 INTO i, j FROM tab
    IF j > 500 THEN
    DELETE FROM tab WHERE CURRENT OF cur1;
    CONTINUE FOREACH;
    END IF
    UPDATE tab SET c2 = c2 + 5 WHERE CURRENT OF cur1;
    END FOREACH
    END PROCEDURE

    Regards,
    Shriyan

Posting Permissions

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