Skip to Content
author's profile photo Former Member
Former Member

Signal in a procedure and catch in another

Hi everyone,

I'm struggling a bit with signalling.

I have a procedure that calls two other procedures. Lets call them Procedure Main, that calls Procedure 1 and Procedure 2.

Now, what I need is to signal an exception from Procedure 1 to Procedure Main.

What's happening is that, even though I have a declare exit handler for SQLEXCEPTION in Procedure Main, when I signal the exception in Procedure 1, it's going to blow up to process and not execute Procedure 2.

Is there some way to achieve this?

Thank you,


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jan 14, 2016 at 04:35 AM

    This is how my main procedure is defined.

    Capture.PNG (7.4 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 14, 2016 at 04:06 AM

    Hi Fábio

    One way probably you could do this by handling exception in your proc1 as out put parameter.

    This is what I did..

    First time if I call this procedure, it would give me 'inserted successfully' message at out put .

    But, if I call this second time, it should give me Error Code as output.

    You just need to catch this Error Code in calling procedure ( main one ) and then process a IF-THEN-ELSE block. .

    First Time Call:

    Second call gives me out put 301 , which is the error code for Unique Key Constraint violation .

    Hope this helps



    Capture.PNG (13.7 kB)
    Capture.PNG (4.8 kB)
    Capture2.PNG (4.9 kB)
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.