my $raOutput = executeProcedure($oDbConfig, q{ declare @default_type int, @default_language_id char(2) exec get_config @default_type output, @default_language_id output }) or die("Could not exec SP\n"); #### =head2 executeProcedure($oDbh, $sql) Execute the SP defined by $sql in $oDbh, and return an array ref with the output parameters. Return undef on failure. Die on db failure. =cut sub executeProcedure { my $self = shift; my $pkg = ref($self); my ($oDbh, $sql) = @_; my $oSth = $oDbh->prepare($sql) or die("Could not prepare SQL ($sql)\n"); $oSth->execute() or die("Could not execute SQL ($sql)\n"); my $raRowOutput = undef; do { while(my $raRow = $oSth->fetch()) { if($oSth->{syb_result_type} == 4042) { # it's a PARAM result $raRowOutput = $raRow; last; } } } while($oSth->{syb_more_results}); return($raRowOutput); }