Oracle how to cast result of a select into a number as data for the next query?
Suppose:
select * from a where id = (select id from b);
Where id
is a number column in table a
, and id
is a varchar column i开发者_运维百科n table b
.
How can i transform the result of select id from b
into a number?
Seems like this doesn't work:
select * from a where id = to_number((select id from b));
select * from a where id = (select to_number(id) from b);
Btw, if you have more than 1 or 0 rows in b
- you need to replace =
operator with IN
精彩评论