how do i cast string to integer in Oracle


how do i cast a string value to integer or float in oracle  ie the value

100.23 is a string field type in table A  and i need to get it into tbale b as a float value using a trigger

all help wil do
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you have two functions available to you .. One is convert

select convert(datatype,value)  

ie select convert(int,mydata)
from test

or you can use to_number

select to_number(data,mask)
from test

The mask help determine the format of the new number.. see the following for a more detailed reference on to_number

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
try to use to_number function. It is the most easiest way to convert string to be number
more function refers can goto
SQL> select to_number('1234.56') - to_number('234.57') result from dual;

SQL> create table abc
  2  (s varchar2(2000));
SQL> insert into abc values ('1234.56');
òúË 1 Ç™.
SQL> commit;
SQL> select to_number(s) from abc;
SQL> select to_number(s) - 234.57 from abc;

Open in new window

rutgermonsAuthor Commented:
Ok thanks

but how do i convert it using a trigger?


Doesnt work

all help will do
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.