Home » SQL & PL/SQL » SQL & PL/SQL » TRIM
TRIM [message #198897] Thu, 19 October 2006 01:16 Go to next message
anandhi
Messages: 31
Registered: April 2006
Location: Chennai
Member
Hi

I have a column with values 1.234, 0.234, -0.456.

what i have to do is i have use the TRIM function to make the values in the column like 1.234, .234, -.456 (ignoring 0 in front of the decimal point)

Please help with the Query

thanks
anandhi
Re: TRIM [message #198907 is a reply to message #198897] Thu, 19 October 2006 02:04 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Where do you get such a result (having 0)? In SQL*Plus? Check whether the default number format is something like 999,990.00. Because, by default, Oracle will omit zero if the column datatype is a NUMBER.

Another option is that this column is of a CHARACTER datatype. Is it? If so, just apply TO_NUMBER function to the column and the result should be OK (unless, again, NUMFORMAT is set to something different than the default).

If none of this is an option, could you explain it a little bit more?
Re: TRIM [message #204756 is a reply to message #198897] Tue, 21 November 2006 23:57 Go to previous message
pravin3032
Messages: 51
Registered: November 2006
Location: eARTH
Member
i guess the column have varchar2 format.
if so use query similar like this one ..

select ltrim(col_name, '0') from test_tab ;




Previous Topic: Create View in Oracle9.2.0.7.0 - Is this a bug?
Next Topic: Substr & Instr
Goto Forum:
  


Current Time: Tue Dec 03 17:53:26 CST 2024