Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> sql query substr

sql query substr

From: Krishan Gupta <Krishan.Gupta_at_etcc.com>
Date: Wed, 8 Feb 2006 15:32:27 -0600
Message-ID: <572B1EA21A6E024EAFC46DE3F1C8B480822ADF@etccex2.etcc.local>


Hello List,  

Look into the queries below, why the result of first two queries is starting with a blank space, and to get rid of this I have to substr from position 2 rather than 1.  

select substr(to_char(34.25,'99.99'),1,5) col1 from dual; --result is
' 34.2'

select substr(to_char(-4.25,'99.99'),1,5) col1 from dual; --result is
' -4.2'

select substr(to_char(34.25,'99.99'),2,5) col1 from dual; --result is
'34.25'

select substr(to_char(-4.25,'99.99'),2,5) col1 from dual; --result is
'-4.25'
 

TIA Krishan  

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Feb 08 2006 - 15:32:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US