PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: mpeppler at itf1 dot itf dot ch (Michael Peppler)
Subject: Re: SybPerl Newbie: Executing stored procedures with parameters
Date: Mar 20 1996 8:17AM

> From: "Cheryl Mitchell" 
> 
> I'm a new subscriber to this list.  I've just started using SybPerl
> 1.0 as of yesterday (3/18/96).  I want to execute a stored procedure that
> has parameters.  How would I do that?

In sybperl 1.0x, you need to do something like this:

&dbcmd($dbproc, "declare @baz int\n");
&dbcmd($dbproc, "exec the_proc 'foo', 'bar', \@baz out\n");
&dbsqlexec($dbproc);
while(&dbresults($dbproc) != $NO_MORE_RESULTS) {
   while(@dat = &dbnextrow($dbproc)) {
       ... # do something with the returned rows, if any
   }
}
print "Return status: ", &dbretstatus($dbproc), "\n" 
     if(&dbhasretstat($dbproc));

# Now get the OUTput parameters from the stpred proc:
%dat = &dbretdata($dbproc, 1)
if($dat{'@baz'} == 2) {
    ....
}


Hope this helps...

Michael