Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Converting a VARCHAR to NUMBER

user263656Feb 2 2012 — edited Feb 2 2012
Hello everyone,
I wonder if you can help me. I have a VARCHAR column called "COLUMN_X" and the value of this column is:
15.41854 
and I'm trying to insert this column into COLUMN_Y of another table, and COLUMN_Y is a NUMBER. When I try to convert COLUMN_X into NUMBER I get an error because there is a blank space after the values on "COLUMN_X". What function can I use to get rid of the space behind the values in "COLUMN_X" so that I can convert it successfully?

So basically I'm trying to do the following:
INSERT INTO TABLE_Y
      (COLUMN_Y)                           --Column Y is a NUMBER type
SELECT TO_NUMBER(COLUMN_X)    --Column X is a VARCHAR type
FROM TABLE_X
Thanking you in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 1 2012
Added on Feb 2 2012
8 comments
249,286 views