473,657 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Regarding a Stored Procedure with comma separated Value in input

hirak1984
316 Contributor
Dear Sir/mam,

I am new comers for DB2 .I Write a Stored Procedure below in line

CREATE PROCEDURE AUS.PROCEDURE1 ( IN var0 VarCHAR(4000),
OUT var1 CHAR(6) )
DYNAMIC RESULT SETS 1
------------------------------------------------------------------------
-- SQL Stored Procedure
-- var0
-- var1
------------------------------------------------------------------------
P1: BEGIN
DECLARE @temp CHAR(4);
DECLARE @OrderID char(100);
DECLARE @Pos int DEFAULT 0;
DECLARE @count int DEFAULT 0;
DECLARE var1_TMP VARCHAR(4000) DEFAULT ' ';
-- CREATE USER TEMPORARY TABLESPACE tab_temp;
declare GLOBAL temporary table SESSION.TempLis t
--declare table AUS.TempList
( OrderID CHAR(6)
)
WITH replace on commit preserve rows not logged in SESSION_TMP_TBS P --DECLARE GLOBAL temporary table <name> (<params>) WITH replace on commit preserve rows not logged in <tblspc_name>
;


SET @Pos = posstr(var0,',' ) ;
SET @temp = CHAR(REPLACE(va r0, ',', ''));
IF @temp <> ''
THEN
WHILE @Pos > 0
DO
SET @OrderID = LTRIM(RTRIM(LEF T(var0, @Pos - 1)));
IF @OrderID <> ''
THEN
INSERT INTO SESSION.TempLis t (OrderID) VALUES (@OrderID); --Use Appropriate conversion
END IF;

SET var0 = RIGHT(var0, (LENGTH(var0) - @Pos)) ;


END WHILE;
END IF ;

--select SESSION.TempLis t.OrderID into var1 from SESSION.TempLis t,AUS.ITM_T where SESSION.TempLis t.OrderID<>AUS. itm_t.itm_nbr ;
END P1


----------------------------------------------------------------
This procedure is executed fine.
But when we will give the input 1111,1234,...,T hat time error comes.

Please Anybody who can help me as review this code & where exactly error comes.
Mar 13 '07 #1
4 4108
willakawill
1,646 Top Contributor
Hi Hirak. This is the introductions forum. You are much more likely to get a response to your question if you post it in the DB2 forum
Thanks
Mar 13 '07 #2
bartonc
6,596 Recognized Expert Expert
Hi Hirak. This is the introductions forum. You are much more likely to get a response to your question if you post it in the DB2 forum
Thanks
Yeah. What Aric said. And besides, you've been here long enough to know that. What's up with that? And not using code tags?
Mar 13 '07 #3
willakawill
1,646 Top Contributor
Yeah. What Aric said. And besides, you've been here long enough to know that. What's up with that? And not using code tags?
Excuse me! Whilst I must consider my upgraded nomineclature to be a promotion of the most flattering ilk, I feel obliged to bring to your attention the notion that our brave Aric may not be equally jubilant.
Mar 13 '07 #4
hirak1984
316 Contributor
Yes there is a problem,someone else is also using it.I have informed admins about it.Please ignore this post.Still I am sorry about it.
Hi Hirak. This is the introductions forum. You are much more likely to get a response to your question if you post it in the DB2 forum
Thanks
Mar 13 '07 #5

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

Similar topics

7
1378
by: Tod Thames | last post by:
I am running SQL Server 7.0 and using a web interface. I would like for a user to be able to input multiple values into a single field with some sort of delimiter (such as a comma). I want to pass this field into a Stored Procedure and have the stored procedure use the data to generate the resutls. Example: Web page would ask for ID number into a field called IDNum. User could input one or many ID numbers separated by a comma or...
0
6693
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft Visual Basic .NET version of this article, see 308049. For a Microsoft Visual C++ .NET version of this article, see 310071. For a Microsoft Visual J# .NET version of this article, see 320627. This article refers to the following Microsoft .NET...
4
1808
by: erich93063 | last post by:
I have a stored procedure which is performing a search against a "task" table. I would like to pass in a variable called @strAssignedTo which will be a comma delimeted list of employee ID's ie: "5,6,10". So my SQL without this variable would be something like: WHERE intAssignedTo IN (5,6,10) but when I try to do: WHERE intAssignedTo IN (@strAssignedTo)
2
5450
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
4
1517
by: nicholas | last post by:
Could someone tell me how to implement an INSERT on an aspx-page using a stored procedure, in VB-code? THX, Nic PS: I have been trying this, but it ain't working: Sub insert_new_content (sender As Object, e As EventArgs)
7
3209
by: JIM.H. | last post by:
Hello, Is there any difference to between SLQ string in the code and call execute query and call a stored procedure and execute the query that way concerning speed, effectiveness, reliability, …? Thanks, Jim.
2
8084
by: karups | last post by:
Hi, I've got listbox in my .aspx page where the users can make multiple selection. So, Users can select any number of items in listbox, I have to take value from items and pass it to stored procedure to extract a dataset back. 1.What should i do while passing the multiple selected values? 2.Can i use 'in' clause in SQL procedure like
0
1270
hirak1984
by: hirak1984 | last post by:
Hi, I am passing an array of comma separated values to a stored procedure. I have to receive them as varchar. but inside I want to get individual integers for some manipulations. How can I get Integers from the varchar which contains comma separated integers? please help
0
1229
hirak1984
by: hirak1984 | last post by:
Dear Sir/mam, I am new comers for DB2 .I Write a Stored Procedure below in line CREATE PROCEDURE AUS.PROCEDURE1 ( IN var0 VarCHAR(4000), OUT var1 CHAR(6) ) DYNAMIC RESULT SETS 1 ------------------------------------------------------------------------ -- SQL Stored Procedure -- var0
0
8305
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,...
0
8823
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
8726
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
8503
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
8603
tracyyun
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...
0
7320
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
6163
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
4151
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...
1
2726
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

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.