Home » SQL & PL/SQL » SQL & PL/SQL » rtrim/ltrim (Oracle 10G)
rtrim/ltrim [message #460097] Wed, 09 June 2010 10:49 Go to next message
salama
Messages: 36
Registered: January 2006
Member
Gentlemen,

I have a ltrim/rtrim function question, I have a field in my table called safetyreportid, it is a varchar2(100char)

when i write the following function:

instr(safetyreportid,chr(10)) >0 I notice in toad that there are three safetyreportid's that have carriage returns at the end. How can i remove these without losing any records. I am assuming I need to use rtrim. However when i use rtrim, I lose a few records in the table. Here are a few things that I have tried

rtrim(SAFETYREPORTID, ' ' || chr(10))
rtrim(SAFETYREPORTID)


Appreciate any tips. Thanks

Re: rtrim/ltrim [message #460098 is a reply to message #460097] Wed, 09 June 2010 10:51 Go to previous messageGo to next message
Michel Cadot
Messages: 68770
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

Post a working Test case: create table and insert statements along with the result you want with these data then we will be able work with your table and data.

Before Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version with 4 decimals.

Regards
Michel
Re: rtrim/ltrim [message #460099 is a reply to message #460098] Wed, 09 June 2010 11:10 Go to previous messageGo to next message
cookiemonster
Messages: 13972
Registered: September 2008
Location: Rainy Manchester
Senior Member
Surely it'd be rtrim(SAFETYREPORTID, chr(10))

No idea what you could possibly be doing to lose rows.
Re: rtrim/ltrim [message #460100 is a reply to message #460099] Wed, 09 June 2010 11:15 Go to previous messageGo to next message
salama
Messages: 36
Registered: January 2006
Member
Thanks, I think I am all set now.
Re: rtrim/ltrim [message #460137 is a reply to message #460100] Wed, 09 June 2010 16:10 Go to previous message
Littlefoot
Messages: 21826
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
However when i use rtrim, I lose a few records in the table

Did you check behind the monitor?
Previous Topic: What is 'Marked for delete' object?
Next Topic: Database Trigger not firing
Goto Forum:
  


Current Time: Tue Sep 09 23:42:22 CDT 2025