Up Prev Next
From: c22309 at j1xsfs90 dot is dot nwa dot com (Mark Conty)
Subject: Re: stored procedure return values
Date: Nov 10 1995 8:46PM
Tamara I King writes:
> I am sure that I am missing something obvious, but is there anyway to
> get the value returned by a stored procedure. I would be interested in
> this in both versions (1 and 2) of sybperl.
(You might want to get a copy of Sybase's OpenClient DB-Lib manual, which
summarizes all the routines in $SYBASE/lib/libsybdb.a. These routines are
the basis for the DBLib support available through Sybperl.)
To (try to) put it briefly, though, there are three different ways to get
something back from a stored procedure:
1. Output generated by -select- statements can be retrieved with a series
of calls to &dbresults() and &dbnextrow.
2. Data fields can be explicitly returned by the stored procedure, but
my DBLib manual doesn't appear to be around here right now, so I
can't remember the SQL command to accomplish this -- I thought it was
something like dbparam() ... ? That data is retrieved by repeated
calls to &dbretdata().
3. The stored procedure itself can return a success/failure code. You
call &dbhasretstat() to see if there _is_ a return status, and
&dbretstatus() to actually pick up that value.
You might want to snoop around in the /eg/ directory in the Sybperl 2.0
distribution package. Michael has put examples of various DBLib and CTLib
code constructs there, and you may find them useful in getting off the
Mark D. Conty firstname.lastname@example.org
Northwest Airlines email@example.com
IS/Applications <>< firstname.lastname@example.org