C# Tutorials and offshore development in India

Tutorials Resources Forum Reviews Interview Jobs Projects Training Your Ad Here


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...




Forums » .NET » SQL Server »

split function in oracle


Posted Date: 15 Apr 2008      Posted By: SatyaPrakashChauhan      Member Level: Silver     Points: 2   Responses: 2



Hi,

In oracle i want to split string. don't know hot to do that.

here is the string str ='1,2,3,3'

I want such type 1
2
3

Pl help me
thanks,





Responses

Author: vipul    15 Apr 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

hi,
for that you refer this link
http://www.oracle.com/technology/oramag/code/tips2004/030104.html
http://www.oracle.com/technology/oramag/code/tips2007/070907.html

Thanks & Regards
Patel Vipul
Developer Heaven



Author: www.DotNetVJ.com    15 Apr 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

Hi,
First create a type

CREATE OR REPLACE
type split_tbl as table of varchar2(32767);
/


and

CREATE OR REPLACE function split
(
p_list varchar2,
p_del varchar2 := ','
) return split_tbl pipelined
is
l_idx pls_integer;
l_list varchar2(32767) := p_list;
l_value varchar2(32767);
begin
loop
l_idx := instr(l_list,p_del);
if l_idx > 0 then
pipe row(substr(l_list,1,l_idx-1));
l_list := substr(l_list,l_idx+length(p_del));

else
pipe row(l_list);
exit;
end if;
end loop;
return;
end split;
/



Thanks -- Vj

Thanks -- Vijaya Kadiyala
http://www.DotNetVJ.com
Microsoft MVP
Me & My Little Techie



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Problem in unique key combination........
Previous : Restrict duplicate row
Return to Discussion Forum
Post New Message
Category: SQL Server

Related Messages




About Us    Contact Us    Privacy Policy    Terms Of Use