List:General Discussion« Previous MessageNext Message »
From:Dan Burke Date:August 18 2005 2:26pm
Subject:Trigger exception handling
View as plain text  

Hello,

I've been looking into converting our existing Oracle PL/SQL code to mysql.  A lot of the
syntax is pretty straight forward, and really doesn't require much change from what I've
been testing with thus far.  However, I'm trying to handle exceptions, and I cannot seem
to find any documentation that shows me what I'm looking for.

In oracle, we have bits of code like this:

        IF INSTR(:new.ACCOUNT_NUM, ' ') > 0 THEN
                RAISE AcctNumHasSpace;
        END IF;

and then

        EXCEPTION
                WHEN AcctNumHasSpace THEN
                        RAISE_APPLICATION_ERROR(-20001, 'Cannot insert space into
ACCOUNT_NUM');

But I cannot seem to figure out how to replicate that behavior.  Is it something that's
possible to do as of yet?  Or not really?  Basically in this situation, we want the
insert to fail if there is a space in that field.

Any advice would be great.

Dan.


_________________________________________________
This e-mail transmission is strictly confidential 
and intended solely for the person or organization 
to whom it is addressed. It may contain privileged 
and confidential information and if you are not the 
intended recipient, you must not copy, distribute or 
take any action in reliance on it. If you have 
received this e-mail in error, please notify the 
sender as soon as possible and delete the e-mail 
message and any attachment(s).

This message has been scanned for viruses 
by TechTeam's email gateway.


Thread
Trigger exception handlingDan Burke18 Aug
  • Re: Trigger exception handlingPeter Brawley19 Aug
RE: Trigger exception handlingDan Burke25 Aug
  • RE: Trigger exception handlingSGreen25 Aug
RE: Trigger exception handlingDan Burke25 Aug