http://qs321.pair.com?node_id=274538


in reply to executing a OSP with CGI

Perhaps a better way would be to:

my $sth=$dbh->prepare("exec OSP_FOO_BAR(?,?,?)") or die $dbh->errstr; $sth->execute($xvar,$yvar,$zvar) or die $sth->errstr;
This way you can capture any errors you generate and you are allowing the DBI interface to do what it does very well and handle any necessary type coversions for your variables.

Hope this helps.


Peter L. BergholdBrewer of Belgian Ales
Peter@Berghold.Netwww.berghold.net
Unix Professional

Replies are listed 'Best First'.
Re: Re: executing a OSP with CGI
by chuleto1 (Beadle) on Jul 15, 2003 at 19:31 UTC
    Thanks for the input. I thougt $sth-execute() was used solely on Select statements
Re: Re: executing a OSP with CGI
by cjcollier (Novice) on Jul 15, 2003 at 21:24 UTC
    You might consider initializing your $dbh thus:
    $dbh = DBI->connect($dsn, $db_user, $db_pass, { RaiseError => 1 } ) or croak "Couldn't connect to database";
    The RaiseError argument will allow you to avoid the
    or die $dbh->errstr
    on each of your database actions.

    Namaste

    C.J.