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 > Informix > How do I show debug from a PROCEDURE CURSOR LOOP

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-27-08, 08:59
andrewhallam andrewhallam is offline
Registered User
 
Join Date: Dec 2003
Location: Nottingham, England
Posts: 52
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
Reply With Quote
  #2 (permalink)  
Old 11-28-08, 12:34
ibm.ids ibm.ids is offline
Registered User
 
Join Date: Nov 2008
Posts: 64
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
Reply With Quote
  #3 (permalink)  
Old 12-02-08, 10:59
andrewhallam andrewhallam is offline
Registered User
 
Join Date: Dec 2003
Location: Nottingham, England
Posts: 52
Thanks for that.
Very handy.
Cheers.
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