Raise exception with parameters
-K-May 18 2007 — edited May 21 2007Hi,
Does anyone know how to hook into raising (predefined) exceptions with parameters?
In a distributed environment I have to write my integrity constraints in triggers. For example, upon deleting, I throw an ORA-02292 myself if a child record exists inside a remote table (PRAGMA EXCEPTION_INIT(CHILD_RECORD_FOUND, -2292)). This results in the message ORA-02292: integrity constraint (.) violated - child record found.
How do I pass someting to the %s parameter of the message? I'd like it to say ORA-02292: integrity constraint (MY_TRIGGER.REMOTE_TABLE) violated - child record found.
If I throw the "stripped" ORA-02292, users won't have a clue as to what's failing.
If I throw a user defined exception, I lose the ORA number, resulting code written specifically to handle these to start failing.
Sure, updating all our exception handlers would be an option... NOT!
Thanks,
K.