Hi All
db2 8.1.3 Windows
I have folowing table structures
CREATE TABLE tb_RTB(
EMP_ID INTEGER,
DESC VARCHAR(20));
CREATE TABLE tb_ERROR(
SQL_STATE CHAR(5),
SQL_DESC VARCHAR(20),
REFER varchar(20));
Following entries are inserted in tb_RTB
INSERT INTO tb_RTB VALUES(1,'MGR') ,(2,'CLK'),(3,' CLK')
I have a stored procedure USP_PROC1
CREATE PROCEDURE WSACES.USP_PROC 1
(IN iEMP_ID INTEGER,
OUT SQLDESC_OUT VARCHAR(20),
OUT SQLSTATE_OUT CHAR(5))
SPECIFIC PROC1
LANGUAGE SQL
P1: BEGIN
DECLARE SQLSTATE CHAR(5) DEFAULT '00000';
DECLARE NO_DATA_FOUND CONDITION FOR SQLSTATE '02000';
DECLARE vSQL_MSG VARCHAR(4096) DEFAULT 'SUCCESS';
DECLARE EXIT HANDLER FOR NO_DATA_FOUND
BEGIN
--Get the error message text
GET DIAGNOSTICS EXCEPTION 1 vSQL_MSG = MESSAGE_TEXT;
SELECT SQLSTATE
INTO SQLSTATE_OUT
FROM SYSIBM.SYSDUMMY 1;
SELECT SQL_DESC
INTO SQLDESC_OUT
FROM tb_ERROR
WHERE SQL_STATE = SQLSTATE_OUT
AND REFER = 'PROC1';
END;
UPDATE tb_RTB
SET DESC = 'MGR'
WHERE EMP_ID = iEMP_ID;
END P1
This procedure updates the table tb_RTB properly.
Now I update the value back to 'CLK' for EMP_ID 2.
I change the GET DIAGNOSTICS position and place it out of Begin - End
Block of handler.
Now the SP is
CREATE PROCEDURE WSACES.USP_PROC 1
(IN iEMP_ID INTEGER,
OUT SQLDESC_OUT VARCHAR(20),
OUT SQLSTATE_OUT CHAR(5))
SPECIFIC PROC1
LANGUAGE SQL
P1: BEGIN
DECLARE SQLSTATE CHAR(5) DEFAULT '00000';
DECLARE NO_DATA_FOUND CONDITION FOR SQLSTATE '02000';
DECLARE vSQL_MSG VARCHAR(4096) DEFAULT 'SUCCESS';
DECLARE EXIT HANDLER FOR NO_DATA_FOUND
--Get the error message text
GET DIAGNOSTICS EXCEPTION 1 vSQL_MSG = MESSAGE_TEXT;
BEGIN
--Get the error message text
-- GET DIAGNOSTICS EXCEPTION 1 vSQL_MSG = MESSAGE_TEXT;
SELECT SQLSTATE
INTO SQLSTATE_OUT
FROM SYSIBM.SYSDUMMY 1;
SELECT SQL_DESC
INTO SQLDESC_OUT
FROM tb_ERROR
WHERE SQL_STATE = SQLSTATE_OUT
AND REFER = 'PROC1';
END;
UPDATE tb_RTB
SET DESC = 'MGR'
WHERE EMP_ID = iEMP_ID;
END P1
This SP doesnot update the table tb_RTB.
Can any gurus explain why is this happening?
Regards
Praveen 5 3066
Praveen_db2 wrote:
DECLARE EXIT HANDLER FOR NO_DATA_FOUND
--Get the error message text
GET DIAGNOSTICS EXCEPTION 1 vSQL_MSG = MESSAGE_TEXT;
This is the end of of handler
>
BEGIN
A nested compound statement, nothing more
--Get the error message text
-- GET DIAGNOSTICS EXCEPTION 1 vSQL_MSG = MESSAGE_TEXT;
SELECT SQLSTATE
INTO SQLSTATE_OUT
FROM SYSIBM.SYSDUMMY 1;
SELECT SQL_DESC
INTO SQLDESC_OUT
FROM tb_ERROR
WHERE SQL_STATE = SQLSTATE_OUT
AND REFER = 'PROC1';
My bet: You're getting a 02000 right here. Exit handler, game over.
END;
UPDATE tb_RTB
SET DESC = 'MGR'
WHERE EMP_ID = iEMP_ID;
END P1
If you drive this through the debugger it should show what happens.
Note that Developer Workbench works against DB2 V8.2, in case you don't
like Developer Center V8.
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
IOD Conference http://www.ibm.com/software/data/ond...ness/conf2006/
Hi Serge
I have debugged it using Development center.It directly jumps into "SELECT
SQLSTATE
INTO SQLSTATE_OUT
FROM SYSIBM.SYSDUMMY 1;" statement after going through the
variable declarations.It does not even go into the UPDATE statement.Pleas e
help by explaining this strange behaviour.
Hi Serge
I have debugged it using Development center.It directly jumps into "SELECT
SQLSTATE
INTO SQLSTATE_OUT
FROM SYSIBM.SYSDUMMY 1;" statement after going through the
variable declarations.It does not even go into the UPDATE statement.Pleas e
help by explaining this strange behaviour.
Praveen_db2 wrote:
Hi Serge
I have debugged it using Development center.It directly jumps into "SELECT
SQLSTATE
INTO SQLSTATE_OUT
FROM SYSIBM.SYSDUMMY 1;" statement after going through the
variable declarations.It does not even go into the UPDATE statement.Pleas e
help by explaining this strange behaviour.
I did. Please reread my post.
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
IOD Conference http://www.ibm.com/software/data/ond...ness/conf2006/
Sorry Serge.
Hadn't gone through your reply properly.
Silly mistake.
Thanks a lot
Praveen This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Syver Enstad |
last post by:
Here's the interactive session
Python 2.2.2 (#37, Oct 14 2002, 17:02:34) on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ord('\xe5')
229
>>> '\xe5'.find(u'')
-1
>>> 'p\xe5'.find(u'')
UnicodeError: ASCII decoding error: ordinal not in range(128)
|
by: john |
last post by:
Hi,All Gurus:
It is kind of complicated, please bear with me and let me know if you have
any questions.
Thanks a lot in advance.
John
I have a csharp method, using emit to dynamically generate classes & method
depends on the meta table in the database,here is my problem
1) One method I generated works when it was called, but another set of
method does not work, it generate the following error
|
by: Curious |
last post by:
Hi,
I have a worker thread running, where basically its operation is to
execute in an infinite loop.
Now, when I am suspending this thread, the CPU usage time is still
remaining 100%.
What could my problem be.
|
by: Lenster |
last post by:
When using PostMessage to post myself a message, the msg and wparam
parameters somehow get swapped over. They are in the correct order when
calling PostMessage but by the time wndproc handles the message msg is now in
the wparam position and msg is set to 0 (NULL message).
Does anyone know why this behaviour is occurring ?
I've included a simple test form below to illustrate this...
|
by: VJ |
last post by:
I get the below error,
System.InvalidOperationException: Process performance counter is disabled,
so the requested operation cannot be performed. at
System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLib
library) at System.Diagnostics.NtProcessManager.GetProcessInfos(String
machineName, Boolean isRemoteMachine) at
System.Diagnostics.ProcessManager.GetProcessInfos(String machineName) at...
| |
by: gamehack |
last post by:
Hi all,
I've been testing out a small function and surprisingly it does not
work okay. Here's the full code listing:
#include "stdlib.h"
#include "stdio.h"
char* escaped_byte_cstr_ref(char byte);
int main (int argc, const char * argv)
|
by: Dox33 |
last post by:
I ran into a very strange behaviour of raw_input().
I hope somebody can tell me how to fix this.
(Or is this a problem in the python source?)
I will explain the problem by using 3 examples. (Sorry, long email)
The first two examples are behaving normal, the thirth is
strange.......
I wrote the following flabbergasting code:
#-------------------------------------------------------------
|
by: Gancy |
last post by:
PROGRAM
StringBuilder sbTest1 = new StringBuilder();
StringBuilder sbTest2 = new StringBuilder();
for (int i = 1; i <= 54; i++)
sbTest1.Append("a");
System.Diagnostics.Debug.WriteLine("sbTest1 =Capacity: "
+ sbTest1.Capacity + ", Length: " + sbTest1.Length);
|
by: DiAvOl |
last post by:
Hello everyone,
Please take a look at the following code:
#include <stdio.h>
typedef struct person {
char name;
int age;
} Person;
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |