MySQL Forums
Forum List  »  Newbie

Re: how can i get the error decription like SQLERRM in oracle within a stored procedure
Posted by: Andrew Gilfrin
Date: February 04, 2005 03:14AM

Ralf sorry I didn't get back to you the other day.

I didn't notice that you had correctly identified that the mysql_error function is part of the C API so when I had a look that becase a bit of a dead end.

Stored Procedures are somewhat in the early stages (still an Alpha release) so there are bound to be things missing that as developers in other stored procedure languages take for granted.

I think the best way to deal with it would be to use Handlers as I suggested. The only problem is that you would need to define a few of them, it depends on what errors you are expecting. If its stuff like
duplicate entry or not null then you could define handlers explicitly for those.

One thing I was going to check but didn't get time to was looking at what would happen if you defined a handler for say sqlstate 23000 and then one for error 1062 (which is contained in sqlstate 23000). Not sure as yet if 1 this would compile or 2 if you could be certain on which would be called. If this would work i.e. individual errors taking precedence over SQLSTATE I think that would be a half way solution and something akin to error handling in Oracle i.e. being able to track specific errors or use 'OTHERS' the big difference with this of course is that you can't then pin down which exact error it was.

I'll try and have a go at defining different handlers and seeing how that works out.

Andrew.

Options: ReplyQuote


Subject
Written By
Posted
Re: how can i get the error decription like SQLERRM in oracle within a stored procedure
February 04, 2005 03:14AM


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.