PL/SQL 'select in' from a list of values whose type are different from the outer query
Posted
by
Attilah
on Stack Overflow
See other posts from Stack Overflow
or by Attilah
Published on 2011-11-14T17:46:14Z
Indexed on
2011/11/14
17:50 UTC
Read the original article
Hit count: 186
I have the following tables :
Table1 ( Col1 : varchar2, Col2 : number, Col3 : number)
Table2 ( Col1 : number, Col2 : varchar2, Col3 : varchar2)
I want to run a query like this :
select distinct Col2 from Table1 where Col1 in
(
select Col1 from Table2
)
Table1.Col1 is of type varchar2 while Table2.Col1 is of type number. so, I need to do some casting, it seems but it fails to succeed.
The problem is that any attempts to run the query returns the following error :
ORA-01722: invalid number
01722. 00000 - "invalid number"
*Cause:
*Action:
Table1.Col1 contains some null values.
© Stack Overflow or respective owner