473,387 Members | 1,512 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,387 software developers and data experts.

Returning exceptions from a SP called from a Trigger...

Hi,

I've implemented calling a SP form a trigger using the
CALL_PROCEDURE()
UDF from
http://www-106.ibm.com/developerwork...402greenstein/

A couple of questions remain for future considerations?

1. This mechanism desn't allow for exceptions/return codes from the
called Stored Procedure to be passed back to the trigger code?
- I think I am going to have to write something to a table in the
SP for the Trigger to then read to determine if any exceptions occured
- seems a bit clumsy?

2. When 'direct' calling of SPs from triggers support is added, will
the Return Status and OUT parameters work directly with variables in
the trigger?

Many thanks.

Paul.
Nov 12 '05 #1
2 1753
Paul Reddin wrote:
Hi,

I've implemented calling a SP form a trigger using the
CALL_PROCEDURE()
UDF from
http://www-106.ibm.com/developerwork...402greenstein/
A couple of questions remain for future considerations?

1. This mechanism desn't allow for exceptions/return codes from the
called Stored Procedure to be passed back to the trigger code?
- I think I am going to have to write something to a table in the
SP for the Trigger to then read to determine if any exceptions occured
- seems a bit clumsy?
That's correct. Either you do this by way of a table (not a temp table,
mind you!) or you use the operating system's facilities to propagate
errors, return codes and/or messages through the "system" call.

Alternatively, you can wait for Stinger which provides a native way to call
procedures from triggers. (The Beta is already available, I think.)
2. When 'direct' calling of SPs from triggers support is added, will
the Return Status and OUT parameters work directly with variables in
the trigger?


I just played around with this a bit, and the error is propagated through
the trigger to the application as you would expect.

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #2
Thanks Knut,

We'll wait for Stinger before we do anything too fancy.

One other problem we did encounter, which is a show-stopper
is that of course the Call to the SP is outside the transaction
scope of the calling trigger, so we can't read the New Row(in the SP) which
fired the trigger because it isn't committed yet.

I guess I could change the UDF to change the isolation to UR for the call to
the SP, but then there are other app. problems with this ......

Ah well, we'll live with what we have for now, but look to go to Stinger
asap.

Thanks again.

Paul.
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: MackS | last post by:
Hi I'm new to Python and would like to know if the following is possible. Say I have one lower-level object A and one user-interface object B. Suppose B.CallingMethod() calls A.CalledMethod(),...
9
by: Simon | last post by:
Hi everyone, I'm wondering what you're supposed to do when you call a method that is required to perform some action but that action subsequently fails. More specifically, how do you get a...
3
by: Sean Tynan | last post by:
I want to find out the best way for a method to notify calling code of situations such as validation errors, etc. that may occur during method execution. e.g. say I have a method (business...
1
by: Military Smurf | last post by:
Okay, so this borrowed code is for doing a recursive file search. The problem is when I encounter the System Volume Information folder, a special kind of exception is thrown that ends up...
25
by: Noah Roberts | last post by:
It is my understanding that this behavior has long been deprecated and is not standard. That is the creation of an array of objects using new returning 0 instead of throwing an exception. I'm not...
3
by: roger.dunham | last post by:
Hi there, I am writing an application that performs calculations on records within a data table. There may be many records in a data table. There are situations where the calculation may not...
3
by: yanksRoll | last post by:
Hi, I'm having a problem with the following trigger: CREATE TRIGGER tr_FamID ON dbo.myFirstTbl FOR INSERT AS DECLARE @address2 VARCHAR (50) DECLARE @compareFamID INT
23
by: pauldepstein | last post by:
Below is posted from a link for Stanford students in computer science. QUOTE BEGINS HERE Because of the risk of misuse, some experts recommend never returning a reference from a function or...
2
by: dsener | last post by:
Hi All, I am a very new beginner to db2 and trying to convert an oracle trigger to a db2 one. My issue is with the exception used in oracle, "EXCEPTION WHEN OTHERS WHEN". How do I convert or in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.