Home » SQL & PL/SQL » SQL & PL/SQL » HOW TO CONVERT A VARCHAR2 TO NUMBER???
HOW TO CONVERT A VARCHAR2 TO NUMBER??? [message #1559] Mon, 13 May 2002 01:45 Go to next message
sorcer
Messages: 19
Registered: January 2002
Junior Member
Hello,
I want to convert a varchar2 to number, i know i can use the TO_NUMBER function but with that field '7895412365' i obtain this error ORA-01455.
Can somebody help me?
Re: HOW TO CONVERT A VARCHAR2 TO NUMBER??? [message #1568 is a reply to message #1559] Mon, 13 May 2002 14:23 Go to previous messageGo to next message
Prasad Swarna
Messages: 4
Registered: May 2002
Junior Member
Split the string using substring and then use to_number to convert the individual pieces into number and then use appropriate arth expression to combine the two numeric pieces into one.
Hope it make sense?
Re: HOW TO CONVERT A VARCHAR2 TO NUMBER??? [message #1585 is a reply to message #1559] Wed, 15 May 2002 01:22 Go to previous messageGo to next message
THA
Messages: 26
Registered: February 2002
Junior Member
check if you are going to insert the number into a column which has lesser width specified than the value you wanted to insert.
other-wise
select to_number(7895412365') from dual;
works fine
Re: HOW TO CONVERT A VARCHAR2 TO NUMBER??? [message #1614 is a reply to message #1585] Thu, 16 May 2002 00:29 Go to previous message
THA
Messages: 26
Registered: February 2002
Junior Member
I can't say why it is not working, but it should work. check the code if there is some silly mistakes. like you have not included the into clause.... or some other mistake.
Previous Topic: cursor
Next Topic: substring and host variable
Goto Forum:
  


Current Time: Fri Apr 26 02:27:39 CDT 2024