473,569 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stored procedure that accepts multiple values

6 New Member
Hi i have a small problem . I need to change one query to stored procedure and call it in my vb.net application.Que ry is :

Select * from emp where empid in (‘001’,’002’)

For this query I need to create a stored procedure and return rows …and the empID I should give as an input parameter ..can u tell me how to write this in stored proc ??

Create or replace procedure emptest
(
EID IN VARCHAR2,
O_RESULT_SET OUT CURSOR_TYPE
)
As
BEGIN
OPEN O_RESULT_SET FOR
SELECT * from emp where empID in (EID);
End;
/

I can execute this for a single value … 001 but I cant put multiple values like (‘001’,’002’) . it is not accepting … can u tell me how to achieve it ??

I am calling this from my .net client application and using a multiselct list box . so the EID may varry from 1 to N number

Regards
Roshla
Jul 19 '07 #1
4 5143
roshnair
6 New Member
Hi i have a small problem . I need to change one query to stored procedure and call it in my vb.net application.Que ry is :

Select * from emp where empid in (‘001’,’002’)

For this query I need to create a stored procedure and return rows …and the empID I should give as an input parameter ..can u tell me how to write this in stored proc ??

Create or replace procedure emptest
(
EID IN VARCHAR2,
O_RESULT_SET OUT CURSOR_TYPE
)
As
BEGIN
OPEN O_RESULT_SET FOR
SELECT * from emp where empID in (EID);
End;
/

I can execute this for a single value … 001 but I cant put multiple values like (‘001’,’002’) . it is not accepting … can u tell me how to achieve it ??

I am calling this from my .net client application and using a multiselct list box . so the EID may varry from 1 to N number

Regards
Roshla
Jul 23 '07 #2
roshnair
6 New Member
Hi i need help . I need to change one query to stored procedure and call it in my vb.net application.Que ry is :

Select * from emp where empid in (‘001’,’002’)

For this query I need to create a stored procedure and return rows …and the empID I should give as an input parameter ..can u tell me how to write this in stored proc ??

Create or replace procedure emptest
(
EID IN VARCHAR2,
O_RESULT_SET OUT CURSOR_TYPE
)
As
BEGIN
OPEN O_RESULT_SET FOR
SELECT * from emp where empID in (EID);
End;
/

I can execute this for a single value … 001 but I cant put multiple values like (‘001’,’002’) . it is not accepting … can u tell me how to achieve it ??

I am calling this from my .net client application and using a multiselct list box . so the EID may varry from 1 to N number

Regards
Roshla
Jul 24 '07 #3
debasisdas
8,127 Recognized Expert Expert
Threads merged for better mangement.

MODERATOR
Jul 26 '07 #4
debasisdas
8,127 Recognized Expert Expert
have a varry or table type declared inside the package specification

then have procedure within a package which wil take one value as paramete and add that value to the table type variable

as the table type variable is declared with in the package specification it will ne alive for the whole section

then in the main procedure access the table type variable using the loop extract each value

u have to construct the sql dynamically
Jul 26 '07 #5

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

Similar topics

4
10645
by: randy.p.ho | last post by:
Using JDBC, is there a way to call a stored procedure with multiple return values? Thanks.
8
7910
by: Thomasb | last post by:
With a background in MS SQL Server programming I'm used to temporary tables. Have just started to work with DB2 ver 7 on z/OS and stumbled into the concept of GLOBAL TEMPORARY TABLE. I have created a temporary database with a tables space. Verified that DECLARE GLOBAL TEMPORARY TABLE TEMP (A INTEGER); INSERT INTO SESSION.TEMP VALUES(10);...
28
72380
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and 2005 Test Environments. What is the purpose of a view if I can just copy the vode from a view and put it into a stored procedure? Should I be...
9
10925
by: anilcool | last post by:
Hi all, Another novice question. I want to insert multiple records into my DB2 database using stored procedure but I do not know how many I would like to insert at any given time. Each record has 6 columns (fields). Here's an example of a stored procedure that accepts 6 parameters and inserts one record. I would like to modify this...
7
3437
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function 'UpdateRegistrant' expects parameter '@EMail', which was not supplied. The field value was null in the database and not changed in the FormView so is...
1
13642
by: deepdata | last post by:
Hi, I am trying to fetch data from db2 (express version) database by calling stored procedure. I have tried to use both cursor and for loop but still i am getting error. --======Start procedure============= Create PROCEDURE get_timedout_scripts (
9
4133
by: fniles | last post by:
I am using VB.NET 2003 and SQL2000 database. I have a stored procedure called "INSERT_INTO_MYTABLE" that accepts 1 parameter (varchar(10)) and returns the identity column value from that table. When calling the stored procedure from VB.NET, in the CommandText, can I just say "INSERT_INTO_MYTABLE '12345'" instead of calling it with...
4
7077
by: yin_n_yang74 | last post by:
I am new to SQL and SQL Server world. There must be a simple solution to this, but I'm not seeing it. I am trying to create a crystal report (v8.5) using a stored procedure from SQL Server (v2000) in order to report from two databases and to enable parameters. When I create the stored procedure, it joins multiple one-to-many relationship...
2
4090
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
0
7703
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...
0
7926
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. ...
0
8138
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...
0
7983
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...
1
5514
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...
0
5223
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...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
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
1
1228
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.