472,354 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

Stored procedure that accepts multiple values

Hi i have a small problem . I need to change one query to stored procedure and call it in my vb.net application.Query 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 4996
Hi i have a small problem . I need to change one query to stored procedure and call it in my vb.net application.Query 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
Hi i need help . I need to change one query to stored procedure and call it in my vb.net application.Query 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 Expert 4TB
Threads merged for better mangement.

MODERATOR
Jul 26 '07 #4
debasisdas
8,127 Expert 4TB
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
by: randy.p.ho | last post by:
Using JDBC, is there a way to call a stored procedure with multiple return values? Thanks.
8
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...
28
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...
9
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...
7
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...
1
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...
9
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....
4
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...
2
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
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made but the http to https rule only works for...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...

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.