PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Can't catch error when sp fails
Date: Aug 8 1999 9:08PM

The error will be raised in the dbresults() calls, not in dbsqlexec()
because the SQL you execute returns more than one result set.

Michael

bruno.georges@barclayscapital.com wrote:
> 
> Hi
> 
> I am writing a script to log errors to syslog when a stroed procedures
> fails.
> 
> In the example below I have the script returning the following error:
>         Server message:
>         Message number: 2812, Severity 16, State 5, Line 1
>         Server 'oplss0026'
>         Message String: Stored procedure 'spFeedSAPCostCodeInfo' not found.
>         Specify owner.objectname or use sp_help to check whether the object
> exists (sp_help may produce lots of output).
> 
> But I am not catching the error using eval .
> 
> Any idea.
> 
> Regards,
> Bruno
> 
> Here the sub my script calls:
> 
> sub feedSAPQCostCode{
>         my($dbh) = @_;
> 
>         my ( $dbq, $resType, $rc);
> 
>         # build query
>         $dbq =  "exec spFeedSAPCostCodeInfo \n";
>         eval{
>                 $dbh->ct_sql("use $conf{'dbname'}");
> 
>                 ($dbh->ct_execute($dbq) == CS_SUCCEED) or die  "Cannot
> execute query";
> 
>                 while(($rc= $dbh->ct_results($resType)) == CS_SUCCEED){
>                         next unless $dbh->ct_fetchable($resType);
>                         while(@dat= $dbh->ct_fetch()){}
>                 }
>         };
>         # I want to raise an alert if the sp fails
>         panic($@) if $@;
> }
> 
> --------------------------------------------------------------------------------------
> For more information about Barclays Capital, please
> visit our web site at http://www.barcap.com.
> 
> Internet communications are not secure and therefore the Barclays Group
> does not accept legal responsibility for the contents of this message.
> Any views or opinions presented are solely those of the author and do
> not necessarily represent those of the Barclays Group unless otherwise
> specifically stated.
> 
> --------------------------------------------------------------------------------------