Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Erik Wendelboe" <erik at wendelboe dot com>
Subject: Too many output parameters?
Date: Sep 22 2005 12:03AM


I am new to this list, and fairly new to Perl/Sybase development.  I am
maintaining an inherited program that worked like a champ, until we upgraded
(long overdue) our Perl version from 5.005_03 to 5.8.3, and reinstalled the
Sybase DBI/DBD (DBI version is 1.48, and DBD version is 1.04).  We are
running on HP-UX 11.11, and are using Sybase 12.5.

While debugging, I found that most stored procedure calls worked just fine,
only one had a problem, resulting in a Memory Fault, and coredump :-(

I found that the stored procedure that caused the coredump returned 8 output
parameters.   After poking around some, I found that by reducing the output
parameters to 5, everything worked perfectly.  I cowardly re-wrote the
stored procedure into 2 different sprocs, each returning 5 output
parameters, calling one right after the other.  It works fine, but I did it
just to keep the project going, it makes me nervous that I don't know why it
is working/not working.

Any pointers and/or help is appreciated.

Erik Wendelboe

Here is the code that calls the original stored procedure (I know I don't
test for the result type before I move it, I put in a check for that, but it
didn't make any difference.  I just wanted to show the original code, before
I 'mangled' it too much.):
sub GetCommandLine{ 
my($scope, $area, $temp_file) = @_; 
my($tmp1, $tmp2, $key); 
my($file_name, $file_date, $file_counter) = GetFileDateCounter($temp_file); 
my($sql) = "declare \@script varchar(80), \@options varchar(80), \@arg1
\@arg2 varchar(40), \@arg3 varchar(40), \@arg4 varchar(40), \@arg5
\@arg6 varchar(40)\n 
exec sp_get_commandline_30 '$scope', '$area', '$file_name', 
\@script output, 
\@options output, 
\@arg1 output, 
\@arg2 output, 
\@arg3 output, 
\@arg4 output, 
\@arg5 output, 
\@arg6 output\n"; 
$sql = $DBH->prepare("$sql"); 
do { 
while($data = $sql->fetch) 
$command_array{"script"} = $data->[0]; 
$command_array{"options"} = $data->[1]; 
$command_array{"arg1"} = $data->[2]; 
$command_array{"arg2"} = $data->[3]; 
$command_array{"arg3"} = $data->[4]; 
$command_array{"arg4"} = $data->[5]; 
$command_array{"arg5"} = $data->[6]; 
$command_array{"arg6"} = $data->[7]; 
} while ($sql->{syb_more_results});