If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > Can any one Tell me How to get column from Comma seperated Srting

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-06-11, 00:26
Mr.Vivek Mr.Vivek is offline
Registered User
 
Join Date: Dec 2011
Posts: 15
Question Can any one Tell me How to get column from Comma seperated Srting

In Stored Procedure there is comma seperated string(ID) is Used
How I can Use it in Where condition by Using "IN"

E.g If i get i/p Like '1,2,3,4,5' in variable

I want used that String like this

Select * from Table
Where ID IN(commaseperatedString);

Plz give Solution
Thanks,
Vivek
Reply With Quote
  #2 (permalink)  
Old 12-06-11, 01:06
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
"Varying elements in IN list" is a search term; here's what Tom Kyte says about it.
Reply With Quote
  #3 (permalink)  
Old 12-06-11, 03:45
Mr.Vivek Mr.Vivek is offline
Registered User
 
Join Date: Dec 2011
Posts: 15
Post

reate or replace
PROCEDURE "GET_STUDENT_CITYWISE"
(

IN_CITY_ID IN VARCHAR2, -- Comma sepereted Multiple CITY_ID
OUT_RESULTSET OUT SYS_REFCURSOR
)
AS

BEGIN

BEGIN

OPEN OUT_RESULTSET FOR
SELECT STUDENT_NAME , STUDENT_EMAIL , STUDENT_MOBILE_NO, STUDENT_CITY
FROM USER
WHERE STUDENT_CITY IN(IN_CITY_ID)

END;

-- Handle exception
EXCEPTION WHEN OTHERS THEN
RAISE;

END GET_STUDENT_CITYWISE;

In the Above Student table STUDENT_CITY This Column having Number Datatype.
I want the Result to Filter the Student on the basis of Cities (CommaSeperated)
??

Last edited by Mr.Vivek; 12-06-11 at 10:02.
Reply With Quote
  #4 (permalink)  
Old 12-06-11, 11:47
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
OK. What did you learn on Ask Tom?
Reply With Quote
  #5 (permalink)  
Old 12-07-11, 00:31
Mr.Vivek Mr.Vivek is offline
Registered User
 
Join Date: Dec 2011
Posts: 15
t's working now ! Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On