Home » SQL & PL/SQL » SQL & PL/SQL » How do you remove CrLf from strings in pl/sql? (Oracle 10g)
- icon5.gif  How do you remove CrLf from strings in pl/sql? [message #309467] Thu, 27 March 2008 10:25 Go to next message
zim327
Messages: 15
Registered: October 2007
Junior Member
Hi,
I need to remove carriage returns (CrLf x0D0A in hex) (and replace them with nothing) which are in the middle of strings

Is there a way to do this with a query or do I need to write a procedure to do this?
How do you specify a CrLf in the replace command?

Thanks,


- Re: How do you remove CrLf from strings in pl/sql? [message #309468 is a reply to message #309467] Thu, 27 March 2008 10:40 Go to previous messageGo to next message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
CrLf can be specified with the ASCII codes, so :

replace( v_string, chr(13) || chr(10), '')


- Re: How do you remove CrLf from strings in pl/sql? [message #309469 is a reply to message #309467] Thu, 27 March 2008 10:54 Go to previous messageGo to next message
zim327
Messages: 15
Registered: October 2007
Junior Member
Thanks for the reply,
unfortunately I tried that and this

REPLACE(filter, CHR(13)||CHR(10), NULL)


and the carriage return is still there! even after I type commit

If anyone has any other suggestions I'm all ears...
- Re: How do you remove CrLf from strings in pl/sql? [message #309473 is a reply to message #309467] Thu, 27 March 2008 11:08 Go to previous message
zim327
Messages: 15
Registered: October 2007
Junior Member
Great news!
I can't believe I found the answer! Here it is:

REPLACE(REPLACE(filter, CHR(10), ''), CHR(13), '')


Enjoy,
Previous Topic: execute immediate with cursor problem
Next Topic: Passing resp_id as parameter urgent.. please help
Goto Forum:
  


Current Time: Wed May 21 06:02:55 CDT 2025