cancel
Showing results for 
Search instead for 
Did you mean: 

Signal in a procedure and catch in another

Former Member
0 Kudos

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,

Fábio

Accepted Solutions (1)

Accepted Solutions (1)

anindya_bose
Active Contributor
0 Kudos

This is how my main procedure is defined. 

Former Member
0 Kudos

Hi Anindya,

That's not exactly what I really wanted, but it works.

Thanks,

Fábio

Answers (1)

Answers (1)

anindya_bose
Active Contributor
0 Kudos

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

Cheers

Anindya