469,313 Members | 2,559 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,313 developers. It's quick & easy.

How to define my own exception in db2 stored procedure

the requirement that i have to meet is:
(pseudocode):

for each table in table_list
loop:
enable constraints on table to filter out all bad data that
violates db constraints;
take the count of the errors in temp_error_count;
total_error_count = total_error + temp_error_count;
if (total_error_count MAX_THRESHOLD)
then
RAISE MY_EXCEPTION
end if;
end loop;

How can i declare exception MY_EXCEPTION in db2?

Jul 5 '07 #1
2 7068
am***********@gmail.com wrote:
the requirement that i have to meet is:
(pseudocode):

for each table in table_list
loop:
enable constraints on table to filter out all bad data that
violates db constraints;
take the count of the errors in temp_error_count;
total_error_count = total_error + temp_error_count;
if (total_error_count MAX_THRESHOLD)
then
RAISE MY_EXCEPTION
end if;
end loop;

How can i declare exception MY_EXCEPTION in db2?
I dont think you need to declare it. Try:

RAISE_ERROR ('77000', 'TOTAL_ERROR_CNT MAX_THRESHOLD')
Jul 5 '07 #2
Lennart wrote:
RAISE_ERROR ('77000', 'TOTAL_ERROR_CNT MAX_THRESHOLD')
RAISE_ERROR() is the choice to raise an exception _within_ an SQL statement.
Commonly it's used as part of COALESCE or CASE-expression.
Within SQL PL the SIGNAL statement performs the same function.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jul 5 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Nathan Sokalski | last post: by
reply views Thread by Tony Do | last post: by
1 post views Thread by Vagabond Software | last post: by
4 posts views Thread by Frank Rizzo | last post: by
reply views Thread by Andy | last post: by
1 post views Thread by darjonase | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.