in reply to calling a stored procedure using DBI.pm

Did you:
... my $sth = $dbh->prepare($StoredProcedureSQL); if(!$sth->execute(@args)) { print "Met with error: ", $sth->errstr, "\n"; # exit / die / croak / return / next / last } while ( my $row = $sth->fetchrow_arrayref ) { ... } ...
Cuz I've done that a million times on Sybase without any problems. Also, check $sth->rows.
-brad..

Replies are listed 'Best First'.
Re^2: calling a stored procedure using DBI.pm
by aroc725 (Acolyte) on Apr 12, 2006 at 20:28 UTC
    Thanks to everyone who took the time to respond.

    I think the documentation may be slightly off. Here's what appears in the documentation I was referred to:
    ...
    $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");
    ...

    Question - isn't the backslash (\) character needed in front of every '@' character within the string containing the stored procedure call ?
      isn't the backslash (\) character needed in front of every '@' character within the string...

      Yes it is. I think under older perls, it may have been just a warning, but now you definitely need the backslash to not try to interpolate arrays in a double quoted string (and is a fatal error under use strict if you try to interpolate a non-existant array).

      Yes, or you could use a single-quoted string.
      You are correct - the backslashes are missing, a typo in the docs which I'll correct.

      Michael