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: 14
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: 25050
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: 64153
Registered: March 2007
Location: Nanterre, France, http://...
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: Sun Dec 11 02:19:18 CST 2016

Total time taken to generate the page: 0.09336 seconds