in reply to Re (2): SQL Stored Procedure return value
in thread SQL Stored Procedure return value
If your stored procedure only returns OUTPUT parameters, then you can use this shorthand: $sth = $dbh->prepare('...'); $sth->execute; @results = $sth->func('syb_output_params'); This will return an array for all the OUTPUT parameters in the proc call, and will ignore any other results. The array will be undefined if there are no OUTPUT params, or if the stored procedure failed for some reason. The more generic way looks like this: $sth = $dbh->prepare( "declare \@id_value int, \@id_name exec my_proc @name = 'a string', @number = 1234, @id = @id_value OUTPUT, @out_name = @id_name OUTPUT" ); $sth->execute; do { while($d = $sth->fetch) { if($sth->{syb_result_type} == 4042) { # it's a PARAM result $id_value = $d->[0]; $id_name = $d->[1]; } } } while($sth->{syb_more_results});
update: Unless of course this is one of those odd little areas where SQLServer and Sybase differ.
-derby
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (4): SQL Stored Procedure return value
by VSarkiss (Monsignor) on Jul 17, 2003 at 18:24 UTC | |
by mpeppler (Vicar) on Jul 17, 2003 at 20:18 UTC | |
by derby (Abbot) on Jul 17, 2003 at 18:42 UTC |