我有一个像这样的查询
SELECT tran_number
FROM table_a WHERE customer_id IN
(SELECT customer_id
FROM table_b
WHERE customer_key = 89564
AND ( other_phn_area_code
|| other_phnum_pfx_num
|| other_phnum_sfx_num IN
(123456789)))
AND phn_area_code || phnum_pfx_num || phnum_sfx_num IN (123456789)
上面的代码工作正常。问题在于内部查询(下面单独复制内部查询)......
(SELECT customer_id
FROM table_b
WHERE customer_key = 89564
AND ( other_phn_area_code
|| other_phnum_pfx_num
|| other_phnum_sfx_num IN
(123456789)))
当我执行此查询时,我收到错误为customer_id: invalid identifier
. 实际上,table_b
没有任何名为customer_id
. 如果是这样,那么当我将它用作上面的内部查询时,它是如何工作的,没有任何问题。
请帮助我理解这一点。
数据库详细信息如下
Oracle 11G Enterprise edition 11.2.0.2.0
PL/SQL Release 11.2.0.2.0