MySQL Forums
Forum List  »  Sybase

Re: Porting code that does a raiseerror
Posted by: Srivats Chandrasekaran
Date: September 17, 2006 11:11PM

Hi,

We also had a similar problem like this. We developed a workaround for this, though i am sure if it is the optimal way of doing things.

we mimicked a table like sysusermessages in mysql and applied the same errorcode, message columns to the table.

And we have a generic function( Ex: getErrorMsg() ) which returns the message string from the table for a given input of the errorcode.

Inside the procedure

MAIN:BEGIN

IF ( some condtion )
select getErrorMsg( errorcode ) as Error;
leave main;
set nb_output_parameter = -1;
END IF;

END MAIN;

So every time we execute a procedure, we check the output_parameter . If it is -1 then we get the error message from the resultset and then throw an exception which otherwise raiserror throws.

Thks
Srivats.C

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Porting code that does a raiseerror
5902
September 17, 2006 11:11PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.