【发布时间】:2012-07-17 08:12:04
【问题描述】:
我有一个类似的查询
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
【问题讨论】:
-
“上述代码运行良好”是什么意思。 - 它会返回一些输出,但您到底想通过这个查询实现什么?您正在尝试从 customer_id 满足的行中获取 tran_number - 什么?