At 11:09 AM 5/21/2008, Heffelfinger, Duane wrote:
As usual I'm probably missing something very simple here, but I've had
some trouble running procedures one after another due to the STP_RETURN
variable. Basically what happens is:
Procedure 1 returns an INTEGER
Procedure 2 returns a TEXT
When I run procedure 2 it fails because procedure 1 created the variable
STP_RETURN as integer.
While I think there are two simple answers:
1. CLEAR VAR STP_RETURN before I run any procedure
2. Have all procedures return a value of TEXT (????) to ensure a large
enough text variable for any procedure
My question is: What is the best practice or am I missing something
easier?
Duey,
RETURN varname option is used ONLY within a Stored Procedure to
return a value.
The returned value is stored in the STP_RETURN system variable. This option
will return an -ERROR- when used outside a Stored Procedure. The default is
TEXT 8 characters, but if you want more, you can set it to a larger value.
You can control the maximum length at procedure definition time, or by editing
the SYS_PROC_LEN column in SYS_PROC_COLS system table.
Example 01:
PUT MyTest.PRC AS MyTest P1 INTEGER RETURN TEXT (30) will set the limit for
the RETURN value at 30 characters.
Hope that helps!
Very Best R:egards,
Razzak.