[英]Oracle invalid identifier in select query in WITH section
为什么我在此查询中收到无效标识符错误?
with
select
notif_set_code as notification_code
, (
select tab_to_string(
cast(collect(
case
when area_type is not null then
count(*) || ' ' || area_type
else 'default'
end
) as t_varchar2_tab), ' ,')
from my_table_2
where notif_set_code = nsd.notification_code
) areas
from my_table nsd
...
它说nsd.notification_code
不是有效的标识符。
如果它不在 with 子句中,则使用nsd.notif_set_code
有效!
据推测,nsd 中没有名为notification_code
的列。 你似乎打算:
where notif_set_code = nsd.notif_set_code
重命名select
中的列不会改变任何内容(尽管令人困惑的是 MySQL 似乎允许在子查询中使用列别名,但这是异常情况)。
但是,您应该真正限定所有列引用:
where my_table_2.notif_set_code = nsd.notif_set_code
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.