Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Location
    Nottingham, England
    Posts
    52

    Unanswered: How do I show debug from a PROCEDURE CURSOR LOOP

    Informix V 7.3:

    I simply want to print out the part returned in the FOREACH loop.
    Currently I'm having to concat all the parts into a string and return that.

    Here's the code:

    isql << !
    DATABASE xxxdb;

    CREATE PROCEDURE ah() RETURNING VARCHAR(100);
    DEFINE part CHAR(30);
    DEFINE ret VARCHAR(100);
    LET ret = "";

    FOREACH cur1 FOR SELECT partnum INTO part FROM partmaster WHERE partnum MATCHES 'A*'

    ??? is there something that I could use like:
    print "part: " + part;
    ???
    LET ret = ret || "|" || TRIM(part);

    END FOREACH

    RETURN ret;

    END PROCEDURE;
    !


    Thanks for any help!

    Andy

  2. #2
    Join Date
    Nov 2008
    Posts
    65
    Provided Answers: 1
    There's no easy way for debugging stored procedures in Informix. If you can afford it, you can use Server Studio (http://www.serverstudio.com/ first 30 days it is free for use, and after that most features are disabled).
    You can use Informix native debugging with trace:

    CREATE PROCEDURE ah() RETURNING VARCHAR(100);
    DEFINE part CHAR(30);
    DEFINE ret VARCHAR(100);
    LET ret = "";

    set debug file to "/tmp/ah.trace.txt";
    -- if using windows
    -- set debug file to "c:\temp\ah.trace.txt";
    FOREACH SELECT partnum INTO part FROM partmaster WHERE partnum MATCHES 'A*'
    trace on;
    LET ret = ret || "|" || TRIM(part);
    trace off;
    END FOREACH
    RETURN ret;


    Or if you want just to debug part you can use trick:

    CREATE PROCEDURE ah() RETURNING VARCHAR(100);
    DEFINE part CHAR(30);
    DEFINE ret VARCHAR(100);
    LET ret = "";

    set debug file to "/tmp/ah.trace.txt";
    -- if using windows
    -- set debug file to "c:\temp\ah.trace.txt";
    FOREACH SELECT partnum INTO part FROM partmaster WHERE partnum MATCHES 'A*'

    trace on;
    LET part = part;
    trace off;
    LET ret = ret || "|" || TRIM(part);
    END FOREACH
    RETURN ret;


    HTH

  3. #3
    Join Date
    Dec 2003
    Location
    Nottingham, England
    Posts
    52
    Thanks for that.
    Very handy.
    Cheers.

Posting Permissions

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