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: "Mark A dot Swank" <mswank at clark dot net>
Subject: RE: Executing stored procedures with parameters
Date: Mar 20 1996 9:34PM

  Drew,

    This is the kind of neat stuff on the sybperl listserver.

  mark

----------
From: 	Tom Wilson[SMTP:73123.1360@compuserve.com]
Sent: 	Tuesday, March 19, 1996 11:11 PM
To: 	sybperl
Subject: 	RE: Executing stored procedures with parameters

>>I want to execute a stored procedure that
>>has parameters.  How would I do that?

There are 2 ways to do it.  The most efficient is to use a remote procedure
call.



$dbh->dbrpcinit("test_proc", 0);
$in='some stuff';
$dbh->dbrpcparam("\@in",0,SYBCHAR,-1,length($in),$in);
$dbh->dbrpcparam("\@out", DBRPCRETURN, SYBINT4, -1, -1, 0) ;
$dbh->dbrpcsend ;
@dat=$dbh->dbretdata;
print ("parms= ",@dat,"\n");

The other way is to execute the stored procedure as a normal SQL command:
Note that here you have to declare a variable (@junk) for the exec even though
it does nothing.

$dbh->dbcmd("declare \@junk int\n");
$dbh->dbcmd("exec test_proc \@in='some stuff',\@out=\@junk output");
$dbh->dbsqlexec;
@dat=$dbh->dbretdata;
print ("parms= ",@dat,"\n");




begin 600 WINMAIL.DAT
M>)\^(BX5`0:0" `$```````!``$``0>0!@`(````Y 0```````#H``$-@ 0`
M`@````(``@`!!) &`#P!```!````# ````,``# #````"P`/#@`````"`?\/
M`0```%,`````````@2L?I+ZC$!F=;@#=`0]4`@````!364)015),+4Q =')L
M;BYL:6(N=6YC+F5D=0!33510`%-90E!%4DPM3$!T``(P`0````4```!33510`````!X``S !````&P```%-90E!%4DPM3$!T
M&5C=71I;F<@&5C=71I;F<@L"
M@P!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