Hi All,
I am very new to DB2 programming. I have written a SQL stored procedure and called it from C# . The program is working but it is not returning the error code and sqlstate code. If i comment out all the code except the DELETE SQL statement it gives error with code "SQL0532" in my program side.
Why the EXIT handler is not invoking? OR Why it is not returning values through OUT parameters.?
Looking forward to hear from you. My stored procedure is given below.I am using iSeries Navigator for writing the the following code so some auto generated is also there.(line 5-17) - CREATE PROCEDURE TYKDFLIB.SP_DELETE (
-
IN PID CHAR(20) ,
-
OUT PSQLSTATE CHAR (5),
-
OUT PSQLCODE INTEGER )
-
LANGUAGE SQL
-
SPECIFIC TYKDFLIB.SP_DELETE
-
NOT DETERMINISTIC
-
MODIFIES SQL DATA
-
CALLED ON NULL INPUT
-
SET OPTION ALWBLK = *ALLREAD ,
-
ALWCPYDTA = *OPTIMIZE ,
-
COMMIT = *NONE ,
-
DECRESULT = (31, 31, 00) ,
-
DFTRDBCOL = *NONE ,
-
DYNDFTCOL = *NO ,
-
DYNUSRPRF = *USER ,
-
SRTSEQ = *HEX
-
BEGIN
-
-
DECLARE SQLSTATE CHAR ( 5 ) DEFAULT '00000' ;
-
DECLARE SQLCODE INT DEFAULT 0 ;
-
-
DECLARE EXIT HANDLER FOR SQLEXCEPTION
-
-
SELECT SQLSTATE , SQLCODE
-
INTO PSQLSTATE , PSQLCODE
-
FROM SYSIBM . SYSDUMMY1 ;
-
-
DELETE FROM TYKDFLIB . TEST01 WHERE ID = PID ;
-
-
VALUES ( SQLSTATE , SQLCODE )
-
INTO PSQLSTATE , PSQLCODE ;
-
-
END ;
-
Thanks in advance!
1 3943
The following Stored procedure is working fine for me.
CREATE PROCEDURE TYKDFLIB.SP_DEL ETE (
IN PID CHAR(20) ,
OUT PSQLSTATE CHAR (5),
OUT PSQLCODE INTEGER )
LANGUAGE SQL
SPECIFIC TYKDFLIB.SP_DEL ETE
NOT DETERMINISTIC
MODIFIES SQL DATA
CALLED ON NULL INPUT
BEGIN
DECLARE SQLSTATE CHAR ( 5 ) DEFAULT '00000' ;
DECLARE SQLCODE INT DEFAULT 0 ;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
SELECT SQLSTATE , SQLCODE
INTO PSQLSTATE , PSQLCODE
FROM SYSIBM . SYSDUMMY1 ;
VALUES ( SQLSTATE , SQLCODE )
INTO PSQLSTATE , PSQLCODE ;
END
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: PeteZ |
last post by:
what using . . . . statement do I need to get this value
(CommandType.StoredProcedure) defined ?
even when I have defined the using statements:
using System;
using System.Data.SqlClient;
using System.Data.Common;
using System.Data.OleDb;
using System.Data.SqlTypes;
|
by: Brian Parker |
last post by:
I've been banging my head on this for hours and it's something that
should be very very easy. I have a Stored Procedure in a MS-SQL 2000
server that returns a Varchar(40) and I want to grab that value in
C-Sharp the easiest way possible. I've tried multiple ways, using
ExecuteNonQuery, ExecuteScalar, etc. and I just can't get the value.
I've tested the SP in SQL Manager and it returns the value just fine.
This is the SP:
|
by: Amol |
last post by:
Hello,
I am developing an apllication in which i want to change the values of
datagrid checkbox column according to parameter passed to the query.
But the problem is that, at first time when i usedto send the
parameter values it shows me the result ok for first time.But as i
change the value of the parameter (taken from textbox on button click)
it doesn't show me the appropriate values(not checking the checkboxes
appropriately).
I am...
|
by: Frank |
last post by:
Hi,
imagine there's a WEB application reading data from an Oracle database
to visualize in using DataGrids in the clients browser. Yes, sounds
simple, just create OracleConnection + OracleCommand + DataAdapter,
bind a DataGrid to the DataAdapter, that's it.
Problem with that approach might be the hardcoded CommandString of the
OracleCommand. Whenever somebody requests query string changes you have
to adapt the C# code, to recompile and...
|
by: phanimadhav |
last post by:
Hello friends,I have one small doubt.Acually myclient asking by using tableAdapetr call the MySQL procedures.How to call the MySQL storedprocedure in TableAdapter.In the Table adapter contain one options is AddQuery.Actually i am using that option.But i am not getting the createStoreprocedure option(means its not visiblemode).Iam using the existing storedprocedure but i am not getting procedureslist in the ComboBox.So any one please help me .Its...
| |
by: gopi2ks |
last post by:
Dear All,
I have one stored procedure like sp_insertEmployee
Employee Table Fileds
Eno int pk,
ename varchar(100),
designation varchar
|
by: Tony Johansson |
last post by:
Hello!
I just wonder when you use StoredProcedure will you then use DataSet ?
In the example that I have seen is the DataSet not used is this normal ?
//Tony
|
by: Tony Johansson |
last post by:
Hello!
Is it possible to use a StoredProcedure when you have SqlDataAdapter or is
it
only possible when you have SqlCommand like
SqlCommand thisCommand = myConnection.CreateCommand;
thisCommand.CommandType = CommandType.StoredProcedure;
thisCommand.CommandText = "MyStoredprocedure";
As far as I can see how would you tell SqlDataAdaper that you will use a
|
by: gabosom |
last post by:
Hi! I've been breaking my head trying to get the output variables from my Stored Procedure.
This is my SP code
CREATE PROCEDURE GetKitchenOrderDetail(
@idService int,
--outPut Variables
@idUser int OUTPUT,
|
by: thesti |
last post by:
hi,
is there anyway to know whether a INSERT/UPDATE/DELETE stored procedured was executed successfully?
for example, if i have the following StoredProcedure:
create procedure sp_add_employee
@userid int,
@password varchar(20)
|
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: 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...
|
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,...
|
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: 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
| |