Further to this, the variable in your SET VAR statement must be typed the
same as the RETURN:
PUT procedure.prc AS procname varname TEXT RETURN INTEGER COMMENT 'This is
the comment'
SET VAR vtest INTEGER = (CALL procname('test'))
... or ...
PUT procedure.prc AS procname varname INTEGER RETURN TEXT COMMENT 'This is
the comment'
SET VAR vtest TEXT = (CALL procname(123))
Emmitt Dove
Manager, DairyPak Business Systems
Evergreen Packaging, Inc.
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(203) 643-8022
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Emmitt Dove
Sent: Wednesday, May 21, 2008 1:02 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: STP_RETURN Variable when running a procedure
Duey,
Have you properly set the return type in your PUT command so that it agrees
with the argument to RETURN in the procedure?
i.e.:
PUT procedure.prc AS procname varname varitype RETURN returntype COMMENT
'This is the comment'
The value "returntype" in the above has to match the argument to RETURN in
the procedure, i.e.:
RETURN 0
In that example the "returntype" must be INTEGER. If you:
RETURN 'abc'
... then "returntype" must be TEXT.
Along with Larry, I, too, have never experienced the issue you report.
Emmitt Dove
Manager, DairyPak Business Systems
Evergreen Packaging, Inc.
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(203) 643-8022
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of
Heffelfinger, Duane
Sent: Wednesday, May 21, 2008 12:42 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: STP_RETURN Variable when running a procedure
Mike,
That's exactly what I thought I could do as well, but at least when SET
TRACE ON is running it appears as though the procedure won't be called
at all if the STP_RETURN variable and the procedure RETURN types are
different. I may add to my enhancement requests some day, but for now
converting RETURN types to text and using the INT function works just
great.
Thanks for everyone's input.
Duey
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of MikeB
Sent: Wednesday, May 21, 2008 11:33 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: STP_RETURN Variable when running a procedure
Duey,
From 6.x days, I have cleared the Store Proc system variable
(STP_RETURN and
MICRORIM_RETURN) as the first line of the procedure. Perhaps it's _not_
required anymore, but no harm comes of it.
----- Original Message -----
From: "Heffelfinger, Duane" <[EMAIL PROTECTED]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Wednesday, May 21, 2008 12:27 PM
Subject: [RBASE-L] - Re: STP_RETURN Variable when running a procedure
Larry,
Interesting. Lately I've been doing this with SET TRACE ON (Rbase 7.6)
and getting a variable type error before the procedure even begins when
the procedure RETURN type is different than the STP_RETURN variable type
from a previously called procedure. I went ahead and converted my
RETURN value to text in my integer procedures, then changed my call
statements to something like:
SET VAR vvar = (INT(CALL actconvert (.vactactual)))
And all is well. Not sure how we differ in what we're doing. I really
like procedures as well and have moved a lot of code to this method.
Duey
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Lawrence
Lustig
Sent: Wednesday, May 21, 2008 10:36 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: STP_RETURN Variable when running a procedure
<<
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.
>>
Duey: I use stored procedures a lot and do not observe the problem
you're reporting. I can run two stored procedures, one after the other,
returning different types and I receive correctly typed return values
each time.
For instance, if I run an integer-returning stored procedure my variable
is set to an integer, and I can see STP_RETURN is an integer value. If
I immediately run a text-returning stored procedure my variable (a
different one, of course) is set to text, and I can see that R:Base has
recreated STP_RETURN as a text variable.
This is in 7.6, but I've been using SPs almost since they were added to
R:Base and have never seen this problem.
--
Larry