Error handling and 'if exists'
Posted by:
Tom Melly
Date: May 11, 2015 07:17AM
Hi,
I have a procedure that basically executes stored sql statements. There is an error handler*, and mostly everything works fine.
However, the following is trapped by the error handler if t_person doesn't exist:
drop temporary table if exists t_person;
Ideally, I'd like to trap:
drop temporary table t_person;
but not the former.
Any ideas?
* the error handler:
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
set @sql = 'select \'Invalid SQL or bad parameter resulting in invalid SQL\' as `Error`';
prepare stmt from @sql;
execute stmt;
END;
Subject
Views
Written By
Posted
Error handling and 'if exists'
2775
May 11, 2015 07:17AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.