By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,558 Members | 1,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,558 IT Pros & Developers. It's quick & easy.

How to define my own exception in db2 stored procedure

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.