我正在使用Oracle Apex,我在SQL查询上收到以下错误消息。
错误讯息:
无法在Builder中解析查询。如果您认为您的查询在语法上是正确的,请检查区域源下方的“通用列”复选框,以便在不进行解析的情况下继续。 ORA-00904:“LECTURE_6”。“CW_ORDER”。“B_ID”:标识符无效
我的SQL查询:
SELECT
"CW_ORDER"."ORD_ID" "ORDER_ID",
"CW_ORDER"."ORD_ID" "ORD_ID",
"CW_ORDER"."B_ID" "B_ID",
"CW_ORDER"."EMP_ID" "EMP_ID",
"CW_ORDER"."FNAME" "FNAME",
"CW_ORDER"."LNAME" "LNAME",
"CW_ORDER"."ADDRESS" "ADDRESS",
"CW_ORDER"."PHONE" "PHONE",
"CW_ORDER"."TYPE" "TYPE",
"CW_ORDER"."ORDERDATE" "ORDERDATE",
"CW_ORDER"."DELIVERYDATE" "DELIVERYDATE",
"CW_ORDER"."PAYMENT" "PAYMENT",
"CW_ORDER"."REMARKS" "REMARKS",
"CW_ORDER"."STATUS" "STATUS",
"CW_ORDER"."FNAME" ||' '|| "CW_ORDER"."LNAME" "CUSTOMER NAME",
(select location from CW_BRANCH
where CW_BRANCH.B_ID = "#OWNER#"."CW_ORDER".B_ID) "Location"
FROM "CW_ORDER" Order by ORD_ID DESC
我只想在查询报告中显示与分支ID(B_ID
)相同行对应的分支的位置。
问题出在(select location from CW_BRANCH where CW_BRANCH.B_ID = "#OWNER#"."CW_ORDER".B_ID) "Location"
上。
答案 0 :(得分:0)
使用此功能。
(select location from CW_BRANCH
where CW_BRANCH.B_ID = "CW_ORDER".B_ID) "Location"
此处,"CW_ORDER".B_ID
在您的from子句中引用CW_ORDER
,因此不需要OWNER
信息。
正如您所提到的OWNER.*
,它实际上是在您的OWNER
子句中引用了一个名为FROM
的表,因而错误。