gpt4 book ai didi

sql - ORA-00904 无效标识符即使列存在

转载 作者:行者123 更新时间:2023-12-01 23:47:25 24 4
gpt4 key购买 nike

我有一个查询,我想在其中生成 SUBSCRIPTION_ID,ORDER_NUMBER。查询工作正常。但我现在还想在创建 SUBSCRIPTION_ID 时显示 START_DATE。但此后我收到错误消息:

ORA-00904: "WF"."START_DATE": invalid identifier
00904. 00000 - "%s: invalid identifier"

这是我的查询:

    select iw.SUBSCRIPTION_ID,iw.ORDER_NUMBER,WF.START_DATE
from (
SELECT TO_NUMBER(REPLACE(REPLACE(REGEXP_SUBSTR(RESPONSE_XML, '<ax2147:subscriptions xsi:type="ax2127:SubscriptionDTO"><ax2130:id>\d+</ax2130:id>'),
'<ax2147:subscriptions xsi:type="ax2127:SubscriptionDTO"><ax2130:id>',''),'</ax2130:id>',''))
AS SUBSCRIPTION_ID ,
CAST(REPLACE(REPLACE(
REGEXP_SUBSTR(REQUEST_XML,'<ns7:orderType>.+</ns7:orderType>'),'<ns7:orderType>',''),'</ns7:orderType>','')
AS VARCHAR(100)) AS order_type,TO_NUMBER(REPLACE(REPLACE(REGEXP_SUBSTR(RESPONSE_XML,'<ax2147:orderNumber>\d+</ax2147:orderNumber>'),'<ax2147:orderNumber>',''),'</ax2147:orderNumber>',''))
AS ORDER_NUMBER,
CREATE_DATE
FROM
SOAP_MONITORING,WF_WORKFLOW ww
where WEB_SERVICE_NAME='RatorWebShopService' and WEB_METHOD_NAME='placeShopOrder'
) iw
where iw.order_type='NEW' and iw.SUBSCRIPTION_ID IN
(select WF.SUBSCRIPTION_ID
from WF_WORKFLOW WF where WF.NAME='SIGNUP_MOBILE_PRE_PAID'
and WF.STATUS_ID=0 and WF.START_DATE < sysdate - 30 / (24 * 60))

最佳答案

问题是 WF_WORKFLOW 仅在用于 IN 谓词的子查询范围内可用,而您在该范围外引用它。

我认为您可以重写查询以使用联接,而不是像这样:

select iw.SUBSCRIPTION_ID,iw.ORDER_NUMBER,WF.START_DATE
from (
SELECT TO_NUMBER(REPLACE(REPLACE(REGEXP_SUBSTR(RESPONSE_XML, '<ax2147:subscriptions xsi:type="ax2127:SubscriptionDTO"><ax2130:id>\d+</ax2130:id>'),
'<ax2147:subscriptions xsi:type="ax2127:SubscriptionDTO"><ax2130:id>',''),'</ax2130:id>',''))
AS SUBSCRIPTION_ID ,
CAST(REPLACE(REPLACE(
REGEXP_SUBSTR(REQUEST_XML,'<ns7:orderType>.+</ns7:orderType>'),'<ns7:orderType>',''),'</ns7:orderType>','')
AS VARCHAR(100)) AS order_type,TO_NUMBER(REPLACE(REPLACE(REGEXP_SUBSTR(RESPONSE_XML,'<ax2147:orderNumber>\d+</ax2147:orderNumber>'),'<ax2147:orderNumber>',''),'</ax2147:orderNumber>',''))
AS ORDER_NUMBER,
CREATE_DATE
FROM
SOAP_MONITORING,WF_WORKFLOW ww
where WEB_SERVICE_NAME='RatorWebShopService' and WEB_METHOD_NAME='placeShopOrder'
) iw
inner join WF_WORKFLOW WF on iw.SUBSCRIPTION_ID = WF.SUBSCRIPTION_ID
where iw.order_type='NEW'
and WF.NAME='SIGNUP_MOBILE_PRE_PAID'
and WF.STATUS_ID=0 and (WF.START_DATE < sysdate - 30 / (24 * 60))

显然我还没有测试过...

关于sql - ORA-00904 无效标识符即使列存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28344429/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com