开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜