473,320 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 7307
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nathan Sokalski | last post by:
I want to create a procedure in ASP.NET to run the "SET DEFINE OFF" command in an Oracle database. I tried the following: Public Shared Sub SetDefineOff() Dim myconnection As New...
0
by: Tony Do | last post by:
Does anyone have problem of running stored procedure from VB .NET using the ODBC driver, The OleDB driver work OK with the same Stored Procedure, also the ASP work OK with that same Stored...
1
by: Vagabond Software | last post by:
An ASP app is calling a T-SQL stored procedure, which creates and instance of a DLL and calls one of its methods. The DLL method creates an instance of an API to process credit card transactions. ...
4
by: Frank Rizzo | last post by:
Hello. Every now and then (it's rare), i get an exception when calling SqlDataAdapter.Fill. The code is calling a stored procedure and attempts to stuff the results into a dataset. It yields the...
0
by: Andy | last post by:
I have an .aspx application that is running on an N-Tier platform. I keep getting the following error: "System.Exception: Timeout expired. The timeout period elapsed prior to completion of the...
2
by: Agnes | last post by:
I got a gobal object which has search function . I will pass 8 paramemter in that object, And In that search function, it will call 'stored procedure' with filling 8 parameters. in that stored...
5
by: Sridhar | last post by:
Hi, I have created a web application. I have a data access dll to interact with database. I added this dll as a reference to the web application. Now let's say if I am calling a function in data...
1
by: darjonase | last post by:
I am trying to call a Stored Prodecure in my code, and I keep getting the same error... system.data.sqlclient.sqlexception: incorrect syntax near the keyword 'Procedure' I have added my...
9
by: Frawls | last post by:
Hi I Am am having problems with a stored Procedure that i wrote. Basically whats happening is that the Stored procedure Runs fine when i EXECUTE it in SQL Query analyzer. But when i debug...
2
by: elaine | last post by:
I'm working on a .net web application. The architect of this web application is quite different than other web applications i worked before. Since we use a set of tools to generate most of the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.