I am getting a frustrating error when i try to insert into the table the trigger i created is on.
Any insight would be appreciated
Error: -
db2 => INSERT INTO trstat VALUES ('340758A', 'POSITION', timestamp ( '2008-08-14-13.53.38.000000' ), '-', 272816, '[0432642N0794126W]No Zone Match',
-
'TM4WIN', 365374, 'ONOAK')
-
DB21034E The command was processed as an SQL statement because it was not a
-
valid Command Line Processor command. During SQL processing it returned:
-
SQL0723N An error occurred in a triggered SQL statement in trigger
-
"USER.RCC_PTIMEST". Information returned for the error includes SQLCODE
-
"-746", SQLSTATE "57053" and message tokens
-
"USER.RCC_PROC_PTIMESTAMP|SQL08081417151250". SQLSTATE=09000
-
Code -
--#SET TERMINATOR @
-
DROP TRIGGER rcc_ptimestamp
-
@
-
DROP PROCEDURE rcc_proc_ptimestamp
-
@
-
-
CREATE PROCEDURE rcc_proc_ptimestamp(
-
IN p_code VARCHAR(10),
-
IN p_new_time TIMESTAMP,
-
IN p_trip_num INTEGER,
-
IN p_status VARCHAR(10)
-
)
-
LANGUAGE SQL
-
MODIFIES SQL DATA
-
-
P1:BEGIN ATOMIC
-
-
DECLARE v_count1 INTEGER DEFAULT 0;
-
DECLARE v_count2 INTEGER DEFAULT 0;
-
DECLARE v_old_time TIMESTAMP;
-
DECLARE SQLCODE INTEGER DEFAULT 0;
-
-
SELECT count(time_changed) INTO v_count2 FROM trstat WHERE trip_9 = p_trip_num AND code = p_code AND status = 'ENRTE';
-
SELECT time_changed INTO v_old_time FROM trstat WHERE trip_9 = p_trip_num AND code = p_code AND status = 'ENRTE';
-
-
IF p_status = 'ENRTE' THEN
-
--ENTER INTO rcc_ptimestamp --current En Routed trips
-
INSERT INTO rcc_ptimestamp (trip_number, start_time) VALUES (p_trip_num, p_new_time);
-
ELSEIF v_count2 <> 0 THEN
-
SELECT count(*) INTO v_count1 FROM rcc_timestamp WHERE trip_number = p_trip_num AND start_time = v_old_time;
-
-
--verify no duplicates in historical table
-
IF v_count1 = 0 THEN
-
--match
-
--INSERT INTO rcc_timestamp
-
INSERT INTO rcc_timestamp (trip_number, start_time, end_time, duration) VALUES (p_trip_num, v_old_time, p_new_time, (p_new_time - v_old_time));
-
--DELETE FROM rcc_ptimestamp
-
DELETE FROM rcc_ptimestamp WHERE trip_number = p_trip_num AND start_time = v_old_time;
-
END IF;
-
END IF;
-
END@
-
-
-
CREATE TRIGGER rcc_ptimestamp AFTER INSERT ON trstat
-
REFERENCING
-
NEW AS NEW
-
FOR EACH ROW MODE DB2SQL
-
-
BEGIN ATOMIC
-
CALL rcc_proc_ptimestamp(NEW.code, NEW.time_changed, NEW.trip_9, NEW.status);
-
END@
-
-
--#SET TERMINATOR ;
-
0 2066 Sign in to post your reply or Sign up for a free account.
Similar topics
by: seth |
last post by:
Last week I encountered an AttributeError in my unit tests that I
wasn'table to catch with an "except AttributeError" statement.
The problem stemmed from a class that raised an error inside...
|
by: jrefactors |
last post by:
I want to distinguish between static SQL, dynamic SQL, and embedded
SQL, but couldn't find too much useful resources in the web.
For example, if we put SQL statements (SELECT, INSERT, UPDATE,...
|
by: sbest |
last post by:
Hi all,
I am trying to execute a MS-SQL 2000 stored proedure from PHP 4.2.2 and
return the single row of 3 output values. I've whittled down the error
messages so that I'm now mainly getting an...
|
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...
|
by: ZorpiedoMan |
last post by:
Well, I'm still wondering around in the "land of the lost exception"...
It seems that controls that are bound to a class and the class throws an
error in the SET method of the bound member, the...
|
by: deepdata |
last post by:
Hi,
I am creating a trigger in DB2 express version.
When i use the following syntax to create trigger
CREATE TRIGGER USER_PK_TRIGGER
BEFORE INSERT On users
REFERENCING NEW As N
FOR EACH...
|
by: Goog79 |
last post by:
Hi everyone,
first time here, so I'm sorry if this has been covered already ages
ago. :(
I am trying to learn T-SQL and Stored Procedures and bought the book
on these topics by Djan...
|
by: cngtx |
last post by:
Hi,
I could not figure out why I am getting the following error when I initiated the Insert into the mainframe DB2 table from a server. I have created the trigger and the stored procedure (as shown...
|
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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: 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...
| |