473,396 Members | 2,013 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,396 software developers and data experts.

SQL0723N, -746 SELECTing from the trigger target

aj
DB2 LUW 8.2 FP5 (or is it 8.1 FP11?)

I am CALLing a stored procedure from a trigger in order to maintain a
column-level audit trail. Not only do I need to store a record of
the INSERT, but also the initial values of all columns as of the INSERT,
in the form of UPDATEs w/ NULL old values.

I pass (amongst other things) a table name and a primary key to the SP
and use dynamic sql and some syscat.columns magic to query the table and
get those initial column values to put into the audit trail.

I am getting a SQL0723N, SQLCODE -746.

Obviously, DB2 doesn't like me querying the trigger target in an SP
that is called from the trigger.

Is there any way around this?

Any help appreciated.

aj
May 24 '06 #1
7 4250
aj wrote:
DB2 LUW 8.2 FP5 (or is it 8.1 FP11?)

I am CALLing a stored procedure from a trigger in order to maintain a
column-level audit trail. Not only do I need to store a record of
the INSERT, but also the initial values of all columns as of the INSERT,
in the form of UPDATEs w/ NULL old values.

I pass (amongst other things) a table name and a primary key to the SP
and use dynamic sql and some syscat.columns magic to query the table and
get those initial column values to put into the audit trail.

I am getting a SQL0723N, SQLCODE -746.

Obviously, DB2 doesn't like me querying the trigger target in an SP
that is called from the trigger.

Is there any way around this?

Pray you have FP11 and follow this link. :-)
http://tinyurl.com/8ndah
It's fixed in Viper by default (not in the viper test drive though).

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 24 '06 #2
aj
Thanks Serge, that did it. (I do have FP 11 on this server).

Too bad it precludes DDL in the SP, tho. Using your advice from
another post, I was using DGTT in the SP w/ ON COMMIT PRESERVE
ROWS.
In the SP, I was shoving the new audit trail rows into the DGTT
as I went, and then finally adding them all to the audit trail
w/ one fast insert from subselect.
Guess I'll have to go back to multiple inserts on the audit trail.

cheers

aj

Serge Rielau wrote:
aj wrote:
DB2 LUW 8.2 FP5 (or is it 8.1 FP11?)

I am CALLing a stored procedure from a trigger in order to maintain a
column-level audit trail. Not only do I need to store a record of
the INSERT, but also the initial values of all columns as of the INSERT,
in the form of UPDATEs w/ NULL old values.

I pass (amongst other things) a table name and a primary key to the SP
and use dynamic sql and some syscat.columns magic to query the table and
get those initial column values to put into the audit trail.

I am getting a SQL0723N, SQLCODE -746.

Obviously, DB2 doesn't like me querying the trigger target in an SP
that is called from the trigger.

Is there any way around this?

Pray you have FP11 and follow this link. :-)
http://tinyurl.com/8ndah
It's fixed in Viper by default (not in the viper test drive though).

Cheers
Serge

May 24 '06 #3
aj wrote:
Thanks Serge, that did it. (I do have FP 11 on this server).

Too bad it precludes DDL in the SP, tho. Using your advice from
another post, I was using DGTT in the SP w/ ON COMMIT PRESERVE
ROWS.

The DDL restriction is gone in DB2 Viper.
But perhaps you could define your DGTT outside the proc (at session
startup).

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 25 '06 #4
Hi!

If I set variable DB2_RESOLVE_CALL_CONFLICT are there any dangers
involved in this ? I don't know, maybe corrupting some data, ...
Do you consider setting this variable safe ?

Best regards,
Kovi

Serge Rielau wrote:
aj wrote:
Thanks Serge, that did it. (I do have FP 11 on this server).

Too bad it precludes DDL in the SP, tho. Using your advice from
another post, I was using DGTT in the SP w/ ON COMMIT PRESERVE
ROWS.

The DDL restriction is gone in DB2 Viper.
But perhaps you could define your DGTT outside the proc (at session
startup).

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab


Jun 2 '06 #5
Kovi wrote:
Hi!

If I set variable DB2_RESOLVE_CALL_CONFLICT are there any dangers
involved in this ? I don't know, maybe corrupting some data, ...
Do you consider setting this variable safe ?

Yes, it's safe. The only cave-at is that in V8 setting this variable
will disallow any DDL inside of the called procedure including DECLARE
GLOBAL TEMPORARY TABLE.

Cheers
Serge

PS: My drive back was harmless and I arrived on time. :-)
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jun 2 '06 #6
OK, great. Since just yesterday we tried to call procedures from
triggers and we got SQL746 error. :)

Best regards,
Kovi

P.S.: Good to hear that. I hope you wedding will be great and that you
don't break that bottle of wine. :)

Serge Rielau wrote:
Kovi wrote:
Hi!

If I set variable DB2_RESOLVE_CALL_CONFLICT are there any dangers
involved in this ? I don't know, maybe corrupting some data, ...
Do you consider setting this variable safe ?

Yes, it's safe. The only cave-at is that in V8 setting this variable
will disallow any DDL inside of the called procedure including DECLARE
GLOBAL TEMPORARY TABLE.

Cheers
Serge

PS: My drive back was harmless and I arrived on time. :-)
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab


Jun 3 '06 #7
Ups ... sorry for that... My mistake...
Kovi wrote:
OK, great. Since just yesterday we tried to call procedures from
triggers and we got SQL746 error. :)

Best regards,
Kovi

P.S.: Good to hear that. I hope you wedding will be great and that you
don't break that bottle of wine. :)

Serge Rielau wrote:
Kovi wrote:
Hi!

If I set variable DB2_RESOLVE_CALL_CONFLICT are there any dangers
involved in this ? I don't know, maybe corrupting some data, ...
Do you consider setting this variable safe ?

Yes, it's safe. The only cave-at is that in V8 setting this variable
will disallow any DDL inside of the called procedure including DECLARE
GLOBAL TEMPORARY TABLE.

Cheers
Serge

PS: My drive back was harmless and I arrived on time. :-)
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab


Jun 3 '06 #8

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

Similar topics

7
by: urban.widmark | last post by:
Hello We are having some problems with triggers, sequences and union all in V8 on code that worked fine in V7. Was wondering if someone else has seen this and/or knows what to do. A trigger...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.