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!

Using TO_NUMBER function in join condition

913578Jan 8 2015 — edited Jan 8 2015

I am trying to join two tables based on two columns one is of varchar2 type and another is NUMBER type

both the columns having data of numbers/numeric only, there is no chars/strings in the data

i am running this query but getting error asĀ  INVALID NUMBER etc.

select * from table1, table2 where to_number(table1.col1)=table2.col2

but i amd getting records for this query

select to_number(col1) from table1;

can we use to_number function in join conditions??

at the same time the below query is working

select * from table1, table2 where table1.col1=to_char(table2.col2)

but our requirement is to convert into number and join....

Please help in this.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 5 2015
Added on Jan 8 2015
8 comments
6,058 views