【发布时间】:2015-02-03 16:44:32
【问题描述】:
我想将值插入到 CAPTURED_DATA_01 表中。 CAPTURED_DATA_01 表中列的值来自 select 语句和 join。因此它有点复杂的 insert 语句。应该从正在运行的查询中添加 SUBSCRIPTION_ID:
Select * from(
select WF.SUBSCRIPTION_ID
from WF_WORKFLOW@FONIC_RETAIL WF,CAPTURED_DATA_01 CP
where WF.SUBSCRIPTION_ID > CP.SUBSCRIPTION_ID and
WF.SUBSCRIPTION_ID IN
(
select iw.SUBSCRIPTION_ID
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@FONIC_RETAIL
where WEB_SERVICE_NAME='RatorWebShopService' and WEB_METHOD_NAME='placeShopOrder'
) iw
where iw.order_type='SELF_REGISTRATION'
)
and WF.NAME='INITIATE_MANDATE'
and WF.STATUS_ID=0 order by wf.START_DATE desc);
这是我尝试过的查询,但在我的子查询中得到错误 cannot use LOB locators selected from remote tables,A remote LOB column cannot be referenced,Remove references to LOBs in remote tables.,我在其中转换了 SUBSCRIPTION_ID、Order_Number、Order_type
Insert into CAPTURED_DATA_01(SUBSCRIPTION_ID) VALUES
((select WF.SUBSCRIPTION_ID
from WF_WORKFLOW@FONIC_RETAIL WF,CAPTURED_DATA_01 CP
where WF.SUBSCRIPTION_ID > CP.SUBSCRIPTION_ID and
WF.SUBSCRIPTION_ID IN
(
select iw.SUBSCRIPTION_ID
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@FONIC_RETAIL
where WEB_SERVICE_NAME='RatorWebShopService' and WEB_METHOD_NAME='placeShopOrder'
) iw
where iw.order_type='SELF_REGISTRATION'
)and WF.NAME='INITIATE_MANDATE'
and WF.STATUS_ID=0))
【问题讨论】:
-
你能发布整个错误吗?错误详细信息可能会更好地说明其失败的原因。此外,您可能会发现创建 sql fiddle 可能有助于展示您所得到的与您想要的。
-
我收到错误,因为无法使用从远程表中选择的 LOB 定位器,无法引用远程 LOB 列,删除对远程表中 LOB 的引用。在我的子查询中,我已经转换了 SUBSCRIPTION_ID,Order_Number,Order_type
标签: sql oracle join sql-insert