Home » SQL & PL/SQL » SQL & PL/SQL » to_number
to_number [message #7711] Wed, 02 July 2003 11:45 Go to next message
Jim Renaud
Messages: 6
Registered: May 2003
Junior Member
I am trying to convert a character string such as '26754.432' to a whole number.

What is problem with this syntax?
'to_number(round(nav_tacsec,0)navtacsec,'.0123456789')

I keep geting a 'missing right parenthesis' error

Thank-a-lot
Jim
Re: to_number [message #7712 is a reply to message #7711] Wed, 02 July 2003 12:19 Go to previous messageGo to next message
Joe
Messages: 138
Registered: November 1999
Senior Member
jim,

not sure what I am missing here but couldn't you just use:

where column_name='26754.432'

select to_number(round(column_name)) from table;
Re: to_number [message #7713 is a reply to message #7712] Wed, 02 July 2003 12:31 Go to previous message
Art Metzer
Messages: 2480
Registered: December 2002
Senior Member
Actually, if the original nav_tacsec column is a VARCHAR2, you should do the TO_NUMBER first, then the ROUND:
SQL> SELECT ROUND(TO_NUMBER(nav_tacsec)) nav_tacsec
  2  FROM  (SELECT '26754.432' nav_tacsec
  3         FROM   DUAL)
  4  /
  
NAV_TACSEC
----------
     26754
  
SQL>
A
Previous Topic: create table
Next Topic: Group By
Goto Forum:
  


Current Time: Fri Apr 26 17:56:28 CDT 2024