Home » SQL & PL/SQL » SQL & PL/SQL » trim with zero leading values
trim with zero leading values [message #210732] Fri, 22 December 2006 01:54 Go to next message
Database admin
Messages: 365
Registered: September 2006
Location: india
Senior Member

hi guys

i have a column with a Fileno's starting say for example as '00664587','05673033',....The thing is what query do we use to remove those leading zeros from a column.

Kindly revert me with the answer.

[Updated on: Fri, 22 December 2006 01:56]

Report message to a moderator

Re: trim with zero leading values [message #210734 is a reply to message #210732] Fri, 22 December 2006 02:08 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

SELECT TRIM (LEADING 0 FROM 000123400) "example" from dual;
Re: trim with zero leading values [message #210737 is a reply to message #210732] Fri, 22 December 2006 02:21 Go to previous messageGo to next message
sandeepshahare
Messages: 20
Registered: December 2006
Location: pune
Junior Member
SQL> SELECT LTRIM('0064587','0') FROM DUAL;

LTRIM
-----
64587
Re: trim with zero leading values [message #210749 is a reply to message #210732] Fri, 22 December 2006 03:25 Go to previous messageGo to next message
jaydeep mitra
Messages: 20
Registered: August 2006
Location: India
Junior Member
hi,
1.select ltrim(columnname,'0') from table name;
2.select replace(column name ,'0') from table name;
Re: trim with zero leading values [message #210750 is a reply to message #210749] Fri, 22 December 2006 03:30 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
You wouldn't want to use REPLACE unless you could guarantee that there were no '0' at any other point in the string thant the start.
Previous Topic: help with sql query using months_between
Next Topic: Configure Oracle using the tns.ora file
Goto Forum:
  


Current Time: Fri Dec 09 09:32:11 CST 2016

Total time taken to generate the page: 0.24024 seconds