Home » SQL & PL/SQL » SQL & PL/SQL » Removing 0's from field
Removing 0's from field [message #1020] Thu, 21 March 2002 06:47 Go to next message
KK
Messages: 24
Registered: March 2002
Junior Member
Hi!

I have data in a column that contains the following data:

TableA.Dept = 0006
TableA.Dept = 0010

TableB.Dept = 6
TableB.Dept = 10

I want to remove the preceeding 0's from the TableA.Dept number so I can compare it to TableB.Dept.

Any help or suggestions would be greatly appreciated!
Thank you!
Re: Removing 0's from field [message #1021 is a reply to message #1020] Thu, 21 March 2002 07:12 Go to previous messageGo to next message
Senthil
Messages: 68
Registered: December 1999
Member
ltrim should help you...

SQL> select * from t;

NO
----------
0006
0010
9999

SQL> select ltrim(no, '0') from t;

LTRIM(NO,'
----------
6
10
9999

that would work if the column type is varchar2...
Re: Removing 0's from field [message #1023 is a reply to message #1021] Thu, 21 March 2002 08:44 Go to previous message
KK
Messages: 24
Registered: March 2002
Junior Member
Thank you for your help!!
Previous Topic: NVL versus IF...THEN
Next Topic: Comma delimited flat file
Goto Forum:
  


Current Time: Fri Apr 26 20:28:02 CDT 2024