Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> How to put a Varchar into a Number?
To those who have helped me already, thanks again. And, to those who help in the future thanks in advance.
I have been trying a syntax similar to the following:
DECLARE
MyNum NUMBER(20,2); MyVar VARCHAR2(20); CURSOR test_cur is select * from XXXX; test_val test_cur%ROWTYPE; BEGIN Open test_cur; Fetch test_cur into test_val; -- test_val.cost is a a VARCHAR2 with this in it =è '006.100' MyVar := test_val.cost ; REPLACE( MyVar . '.' ); MyNum := MyVar; -- *********** Blows here
END; I thought Oracle would automatically convert the Varchar2 in the line marked "*********** Blows here" to a NUMBER. However, that does not seem to work. Using TO_NUMBER(MyVar ); doesn't work either;
Does any one know how I can convert a Vaarchar2 into a Number so I can then do a ( MyNum / 5 )?
Best,
Ken Sproule
Kenmn_at_tds.net
Received on Tue Feb 08 2000 - 20:46:50 CST
![]() |
![]() |