473,699 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

db2 LUW v8 after inser trigger encounter error sql0348

Problem: after inser trigger encounter error sql0348

Env:db2 v8 + fp 13 + win xp

Description:
we build two after insert triggers DB2.TRG1, DB2.TRG2 on base table
DB2.TEST1,
insert data into DB2.TEST1 encounter error sql0348

but we re-create trigger DB2.TRG2 before DB2.TRG1 and re-insert data
into DB2.TEST1 successfully.

did anyone can help to advice why db2 create triggers sequence will
get difference result ?
sample case as follow:
=============== =============== =============== =============
connect sample @

drop view db2.sum @
drop trigger DB2.TRG1 @
drop trigger DB2.TRG2 @
drop table DB2.Q1 @
drop table DB2.Q2 @
drop table DB2.TEST1 @
drop table DB2.T1 @
drop table DB2.T2 @
drop sequence db2.test_1_seq @

CREATE SEQUENCE DB2.TEST_1_SEQ AS INTEGER
MINVALUE 1 MAXVALUE 2147483647
START WITH 1 INCREMENT BY 1
CACHE 10000 CYCLE NO ORDER @

create table db2.t1 (id int, name varchar(5), dep varchar(5), code
int ) @
create table db2.t2 (id int, name varchar(5), dep varchar(5), code
int ) @
create table DB2.TEST1 ( ID INT, NAME CHAR(10)) @
create table DB2.Q1 ( ID INT, NAME CHAR(10)) @
create table DB2.Q2 ( ID INT, NAME CHAR(10)) @

create view db2.sum ( id, name, code )
as
select id, name, dep
from db2.t1
where dep='A00'
union all
select id, name, dep
from db2.t1
where dep='B00' @
create trigger DB2.TRG1
after insert on DB2.TEST1
referencing
new as nw_row for each row
mode db2sql
BEGIN ATOMIC
IF ( (select count(*) from syscat.indexes) 10 )
THEN
insert into DB2.Q1 (ID, NAME)
values (
(select count(*) from DB2.SUM),
-- nw_row.ID,
nw_row.NAME) ;
ELSE
insert into DB2.Q1 (ID, NAME)
values ( (500+nw_row.ID) ,
nw_row.NAME) ;
END IF;
END @

create trigger DB2.TRG2
after insert on DB2.TEST1
referencing
new as nw_row for each row
mode db2sql
BEGIN ATOMIC
insert into DB2.Q2 (ID, NAME)
values ( NEXTVAL FOR DB2.TEST_1_SEQ,
nw_row.NAME) ;
END @
=============== =============== =============== =============
Insert data:
db2 connect to sample
db2 "insert into db2.test1 values(11111,'x xyyzz') "
* will get error sql0348

if re-create trigger DB2.TRG2 before DB2.TRG1 , the trigger will
successfully without error.

Thanks

Apr 26 '07 #1
2 3362
wu*******@gmail .com wrote:
Problem: after inser trigger encounter error sql0348

Env:db2 v8 + fp 13 + win xp

Description:
we build two after insert triggers DB2.TRG1, DB2.TRG2 on base table
DB2.TEST1,
insert data into DB2.TEST1 encounter error sql0348

but we re-create trigger DB2.TRG2 before DB2.TRG1 and re-insert data
into DB2.TEST1 successfully.

did anyone can help to advice why db2 create triggers sequence will
get difference result ?
That's a bug! Can you call support and get an APAR opened?
Your repro is good. If support gives you a headache refer them to me. :-)

Chers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Apr 26 '07 #2
On Apr 27, 1:13 am, Serge Rielau <srie...@ca.ibm .comwrote:
wugon....@gmail .com wrote:
Problem: after inser trigger encounter error sql0348
Env:db2 v8 + fp 13 + win xp
Description:
we build two after insert triggers DB2.TRG1, DB2.TRG2 on base table
DB2.TEST1,
insert data into DB2.TEST1 encounter error sql0348
but we re-create trigger DB2.TRG2 before DB2.TRG1 and re-insert data
into DB2.TEST1 successfully.
did anyone can help to advice why db2 create triggers sequence will
get difference result ?

That's a bug! Can you call support and get an APAR opened?
Your repro is good. If support gives you a headache refer them to me. :-)

Chers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Thanks your advice.

Apr 27 '07 #3

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

Similar topics

0
7143
by: Dave Sisk | last post by:
I've created a system or external trigger on an AS/400 file a.k.a DB2 table. (Note this is an external trigger defined with the ADDPFTRG CL command, not a SQL trigger defined with the CREATE TRIGGER statement.) I've also defined a SQL stored proc, and the trigger is set to call this SP. I've posted the simplified source below. I can manually call the stored proc, and the external trigger is created without any errors. However, when I do...
2
1770
by: Paul Reddin | last post by:
Hi, I've implemented calling a SP form a trigger using the CALL_PROCEDURE() UDF from http://www-106.ibm.com/developerworks/db2/library/techarticle/dm-0402greenstein/ A couple of questions remain for future considerations? 1. This mechanism desn't allow for exceptions/return codes from the
4
4176
by: Alexander Pope | last post by:
I am using db2 udb v8.2 AIX I have created trigger, however I am not confident it meets industry standards. If I make it fail, I cant tell from the message where it is failing. what can I add to trap the errors properly? CREATE TRIGGER myschema.t1_upd_t AFTER UPDATE OF dt ON myschema.t1 REFERENCING NEW AS N
12
4756
by: Bob Stearns | last post by:
I am trying to create a duplicate prevention trigger: CREATE TRIGGER is3.ard_u_unique BEFORE UPDATE OF act_recov_date ON is3.flushes REFERENCING NEW AS N FOR EACH ROW MODE DB2SQL WHEN (N.act_recov_date IS NOT NULL) BEGIN ATOMIC select count(*) into v_n from is3.flushes
5
3294
by: Bob Stearns | last post by:
I have two (actually many) dates in a table I want to validate on insertion. The following works in the case of only one WHEN clause but fails with two (or more), with the (improper? inappropriate?) error message: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: CREATE TRIGGER IS3.date_later_001i NO C;BEGIN-OF-STATEMENT;<space> which is interpreted as: An unexpected token "CREATE TRIGGER IS3.date_later_001i NO C" was found
1
1586
by: flash | last post by:
Need hlep to delete array only because all function is ok (inser, sort andsearch) #include <iostream.h> //functions prototype void Insert(int,int); void Delete(int,int); int Search(int,int); void Sort(int,int);
2
2697
by: alivip | last post by:
when I wont to inser (anyting I print) to the textbox it will not inser it just print then hanging # a look at the Tkinter Text widget # use ctrl+c to copy, ctrl+x to cut selected text, # ctrl+v to paste, and ctrl+/ to select all # count words in a text and show the first ten items # by decreasing frequency
11
7872
by: tracy | last post by:
Hi, I really need help. I run this script and error message appeal as below: drop trigger log_errors_trig; drop trigger log_errors_trig ERROR at line 1: ORA04080: trigger 'LOG_ERRORS-TRIG' does not exist drop table log_errors_tab;
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
8622
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9184
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9045
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8930
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8892
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7767
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4382
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3062
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.