473,666 Members | 2,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Embedded SQL returning uncatchable error - Procedure/Trigger

1 New Member
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:
Expand|Select|Wrap|Line Numbers
  1. db2 => INSERT INTO trstat VALUES ('340758A',     'POSITION', timestamp ( '2008-08-14-13.53.38.000000' ), '-',             272816, '[0432642N0794126W]No Zone Match',
  2.             'TM4WIN',                    365374, 'ONOAK')
  3. DB21034E  The command was processed as an SQL statement because it was not a
  4. valid Command Line Processor command.  During SQL processing it returned:
  5. SQL0723N  An error occurred in a triggered SQL statement in trigger
  6. "USER.RCC_PTIMEST".  Information returned for the error includes SQLCODE
  7. "-746", SQLSTATE "57053" and message tokens
  8. "USER.RCC_PROC_PTIMESTAMP|SQL08081417151250".  SQLSTATE=09000
  9.  
Code
Expand|Select|Wrap|Line Numbers
  1. --#SET TERMINATOR @ 
  2. DROP TRIGGER rcc_ptimestamp
  3. @
  4. DROP PROCEDURE rcc_proc_ptimestamp
  5. @
  6.  
  7. CREATE PROCEDURE rcc_proc_ptimestamp(
  8.     IN p_code            VARCHAR(10),
  9.     IN p_new_time    TIMESTAMP,
  10.     IN p_trip_num    INTEGER,
  11.     IN p_status        VARCHAR(10)
  12. )
  13.     LANGUAGE SQL
  14.     MODIFIES SQL DATA
  15.  
  16.     P1:BEGIN ATOMIC
  17.  
  18.     DECLARE v_count1 INTEGER DEFAULT 0;
  19.     DECLARE v_count2 INTEGER DEFAULT 0;
  20.     DECLARE    v_old_time    TIMESTAMP;
  21.     DECLARE SQLCODE INTEGER DEFAULT 0;
  22.  
  23.     SELECT count(time_changed) INTO v_count2 FROM trstat WHERE trip_9 = p_trip_num AND code = p_code AND status = 'ENRTE';
  24.     SELECT time_changed INTO v_old_time FROM trstat WHERE trip_9 = p_trip_num AND code = p_code AND status = 'ENRTE';  
  25.  
  26.     IF p_status = 'ENRTE' THEN
  27.         --ENTER INTO rcc_ptimestamp --current En Routed trips
  28.         INSERT INTO rcc_ptimestamp (trip_number, start_time) VALUES (p_trip_num, p_new_time);
  29.     ELSEIF v_count2 <> 0 THEN            
  30.         SELECT count(*) INTO v_count1 FROM rcc_timestamp WHERE trip_number = p_trip_num AND start_time = v_old_time;
  31.  
  32.                 --verify no duplicates in historical table
  33.         IF v_count1 = 0 THEN
  34.             --match
  35.              --INSERT INTO rcc_timestamp
  36.              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));
  37.              --DELETE FROM rcc_ptimestamp
  38.              DELETE FROM rcc_ptimestamp WHERE trip_number = p_trip_num AND start_time = v_old_time;
  39.         END IF;
  40.     END IF;
  41. END@
  42.  
  43.  
  44. CREATE TRIGGER rcc_ptimestamp AFTER INSERT ON trstat
  45. REFERENCING 
  46.     NEW AS NEW
  47. FOR EACH ROW MODE DB2SQL 
  48.  
  49. BEGIN ATOMIC    
  50.     CALL rcc_proc_ptimestamp(NEW.code, NEW.time_changed, NEW.trip_9, NEW.status);
  51. END@
  52.  
  53. --#SET TERMINATOR ;
  54.  
Aug 14 '08 #1
0 2079

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2462
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 __init__and defined a __del__ method to clean up resources. I then discovered asimilar problem in the shelve module. This led me to two importantdiscoveries: 1. Attributes defined in __init__ after an error is raised will not be apart of the...
4
4785
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, etc...) inside an application (e.g. Java application, VB application, etc...), do we consider those SQL statements as static SQL? or embedded SQL? How about dynamic SQL? any practical examples? Please advise. thanks!!
0
1344
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 error message that the MS-SQL Query ($sql) failed. Here's the stored procedure statements that define the input and output variables: CREATE PROCEDURE dbo.sl_mostrecent_State
2
1769
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
7
1701
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 exception cannot be caught. I have wrapped my entire application in all the global exception handlers I can find, and still to no avail. In fact all the Try/Catches and Exception event handlers are worthless... Put on your advanced thinking...
1
2206
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 ROW
3
6039
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 Sunderic, Publisher McGraw Hill/Osborne. I'm already stuck on my first Stored Procedure and getting error messages that I cannot understand. I've already tried Google and Microsoft online to no avail. I do have the .NET Framework on my system and use
0
2047
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 below). If I insert a row into the table using batch sql job on mainframe, the stored procedure is triggered by the db2 trigger successfully after a row is inserted into the table. However, if I do the same insert through front-end apps using a...
2
19458
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
8440
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8866
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
8781
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
8550
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
7381
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...
1
6191
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4365
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
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
2006
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.