Home » SQL & PL/SQL » SQL & PL/SQL » Enclosing comma separated values within single quotes (4 merged) (Oracle 9i,Windows XP)
Enclosing comma separated values within single quotes (4 merged) [message #442526] Mon, 08 February 2010 22:01 Go to next message
anil029
Messages: 15
Registered: February 2010
Junior Member
Hi all,
I have a string which contains comma separated values like AAA,BBBB,CC,DDD,.......It has more than 100 values.I want to enclose all the values with in single quotes as 'AAA','BBBB','CC','DDD',........
Can you anyone suggest me some way to do it.

Thanks in advance.
Anil
Re: Enclosing comma separated values within single quotes (4 merged) [message #442531 is a reply to message #442526] Mon, 08 February 2010 22:31 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Can you anyone suggest me some way to do it.
This is NOT an Oracle problem & can be easily done with most text editors.

Replace all commas with single quote comma single quote,
& you need to manually fix both ends of the text line

in vi it would be done as below
s/,/','/g
Re: Enclosing comma separated values within single quotes (4 merged) [message #442540 is a reply to message #442526] Mon, 08 February 2010 23:07 Go to previous messageGo to next message
Michel Cadot
Messages: 68757
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
''''||replace(str,',',''',''')||''''

Regards
Michel
Re: Enclosing comma separated values within single quotes (4 merged) [message #442610 is a reply to message #442526] Tue, 09 February 2010 07:07 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
If you are thinking that you can then use this string in an IN command, then I'm afraid it won't work.

Previous Topic: Is there a way to tell what Oracle tables are getting updated? (2 merged)
Next Topic: DBMS_SCHEDULER
Goto Forum:
  


Current Time: Mon May 19 01:41:20 CDT 2025