How to handle exceptions 'Call failed' in procedure?

Analytics
Enthusiast

How to handle exceptions 'Call failed' in procedure?

Hi, All

I have a main procedure which is used to invoke other sub-procedures. I've added the 'DECLARE EXIT HANDLER FOR SQLEXCEPTION' in the main procedure. But when any exception raised in sub-procedure, the HANDLER in main procedure doesn't work. So how can I catch exceptions generated in all sup-procedures?

vertion of my TD is 13.1, and the following is the simplified of my code.

REPLACE PROCEDURE proc_main()

BEGIN

-- # Handl SQLException

DECLARE EXIT HANDLER FOR SQLEXCEPTION

BEGIN

insert log table.

END;

CALL proc_sub();

END; 

Thanks!

Frank Liu

Tags (2)
2 REPLIES
Senior Apprentice

Re: How to handle exceptions 'Call failed' in procedure?

Hi Frank,

are those errors already catched by exception handlers in the sub-procedures? 

Only unhanded exceptions are propagated to the calling procedure.

You can use RESIGNAL to throw an error again.

Can you provide more details?

Enthusiast

Re: How to handle exceptions 'Call failed' in procedure?

Hi, Dieter

Thanks for your reply. Have modified my procedures and used RESIGNAL to raise my own exception.

Thanks!

Frank Liu