Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2008
    Posts
    8

    Unanswered: Procedure that returns a cursor

    Ok, I'm still having problems returning cursors from db2 procedure..

    For example:
    I have a procedure A, that return a cursor:

    CREATE PROCEDURE A ( )
    DYNAMIC RESULT SETS 1
    P1: BEGIN
    DECLARE cursor1 CURSOR WITH RETURN TO CLIENT FOR
    SELECT handle, descricao from sam_grau;
    OPEN cursor1;
    END P1


    And I have a procedure B that must to open procedure A and read it like a cursor.

    ?
    How to do this ?


    Thanks.

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Nov 2008
    Posts
    8
    I can't see how can I use the opened cursor inside the caller procedure.
    How can I do that ?

  4. #4
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Since you specify the cursor as RETURN TO CLIENT, you cannot do that, of course.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  5. #5
    Join Date
    Nov 2008
    Posts
    8
    Hi stolze, can you send me an example of how can I do this ?

    Procedure A opens a cursor and procedure B use this cursor.

    Thanks.

  6. #6
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Yes, open the cursor WITH RETURN TO CALLER. See the manual for that.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

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