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: Dennis Domingo <bigmango at yahoo dot com>
Subject: Re: How to get SP error messages
Date: Jul 23 2002 2:15AM

it looks like you can use $DB_ERROR

             The nsql() routine will maintain the success or
             failure state in a variable $DB_ERROR, accessed by
             the method of the same name, and a pair of Sybase
             message/error handler routines are also provided
             which will use $DB_ERROR for the Sybase messages and
             errors as well.  However, these must be installed by
             the client application:
             Success of failure of an nsql() call cannot
             necessarily be judged from the value of the return
             code, as an empty array may be a perfectly valid
             result for certain sql code.
             The following code is the proper method for handling
             errors with use of nsql.
                 @ret = $dbh->nsql("select stuff from table where stuff = 'nothi
                 if ( $DB_ERROR ) {
                   # error handling code goes here, perhaps:
                   die "Unable to get stuff from table: $DB_ERROR\n";

is CNET hiring :)
  Alex Quezada  wrote: Hi,

I'm using Sybase::DBlib to execute an SP, and this SP returns an error message:

couser-SF_CON_DEV1 1>EditElement @elementId=953684, @userId=100;
Msg 20023, Level 16, State 1
Server 'SF_CON_DEV1', Procedure 'EditElement', Line 76
Alex Quezada already has that 953684 checked out.
(return status = -114)

So I'd like to pass this error message along, but for the life of me I can't find the method to read the error message. I can grab the return status just fine, but that isn't enough since it doesn't give me the error details (like who has checked stuff out).

Anyone know what method I can use to grab this info?


Alex Quezada

Do You Yahoo!?
Yahoo! Health - Feel better, live better