Unix Technical Forum

output param & multiple recordests from stored procedures

This is a discussion on output param & multiple recordests from stored procedures within the SQL Server forums, part of the Microsoft SQL Server category; --> here's my code: my $sth = $dbhSQL->prepare('{call proc(?,?,?)}'); $sth->bind_param(1,"asd"); $sth->bind_param(2,"klm"); $sth->bind_param_inout(3,\$no_go, 1000); $sth->execute; print "no go = $no_go\n"; while( ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 07:43 PM
Cliff
 
Posts: n/a
Default output param & multiple recordests from stored procedures

here's my code:

my $sth = $dbhSQL->prepare('{call proc(?,?,?)}');
$sth->bind_param(1,"asd");
$sth->bind_param(2,"klm");
$sth->bind_param_inout(3,\$no_go, 1000);
$sth->execute;
print "no go = $no_go\n";
while(
my @row=$sth->fetchrow_array){
print "@row\n";
}
$sth->finish;

Here's my stored procedure:

CREATE PROCEDURE proc
@id varchar(50),@iyt varchar(20),@no_go int OUTPUT
AS
SET NOCOUNT ON
DECLARE @id_err int,@ans_glue_err int

BEGIN TRANSACTION
SELECT user_id FROM myTable
WHERE user_id=@id AND iyt=@iyt
SET @id_err = @@ERROR
IF @@ROWCOUNT <> 0
BEGIN
SELECT date,date_mod FROM ans_glue
WHERE user_id=@id
SET @no_go = 0
SET @ans_glue_err=@@ERROR
END
ELSE
BEGIN
SET @no_go = 1
END
IF @id_err = 0 AND @ans_glue_err = 0
BEGIN
COMMIT TRANSACTION
END
ELSE
BEGIN
ROLLBACK TRANSACTION
END

the procedure runs perfectly in Cold Fusion, returning both recordsets
and output param, but in perl, it won't print the output param and I
don't know how to access the second recordset
HELP!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 07:43 PM
Erland Sommarskog
 
Posts: n/a
Default Re: output param & multiple recordests from stored procedures

Cliff (cliff@walkacrossfire.com) writes:
> here's my code:
>
> my $sth = $dbhSQL->prepare('{call proc(?,?,?)}');
> $sth->bind_param(1,"asd");
> $sth->bind_param(2,"klm");
> $sth->bind_param_inout(3,\$no_go, 1000);
> $sth->execute;
> print "no go = $no_go\n";
> while(
> my @row=$sth->fetchrow_array){
> print "@row\n";
> }
> $sth->finish;
>...
> the procedure runs perfectly in Cold Fusion, returning both recordsets
> and output param, but in perl, it won't print the output param and I
> don't know how to access the second recordset
> HELP!


You are probably better off to ask this in a forum devoted to DBI.
ActiveState hosts a mailing list, see
http://aspn.activestate.com/ASPN/Mai...eaded/perl-DBI.


--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:54 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com