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

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,'xxyyzz') "
* 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 3342
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
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...
2
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...
4
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...
12
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...
5
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?...
1
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...
2
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, #...
11
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'...
0
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
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
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
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,...

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.