我想在CAPTURED_DATA_01表中插入值。 CAPTURED_DATA_01表中的列的值来自select语句和join.So它的一点点复杂的insert语句。应该从运行查询的select查询中添加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))
答案 0 :(得分:0)
您无法在子查询表达式中选择多个列,也无法选择足够的值。您不需要添加额外级别的子查询,您需要以下内容:
Insert into CAPTURED_DATA_01(EVENT_ID,SUBSCRIPTION_ID,EVENT_TIMESTAMP,
ENV_ID,BRAND_ID,BP_ID)
Select '10006',SUBSCRIPTION_ID,START_DATE,
ENV_ID,BRAND_ID,BP_ID -- where are these coming from? should they be literals too?
from(
select WF.SUBSCRIPTION_ID,WF.START_DATE
from WF_WORKFLOW@FONIC_RETAIL WF,CAPTURED_DATA_01 CP
...
虽然不清楚ENV_ID,BRAND_ID,BP_ID
值的来源,但您可能也希望这些值也是字面值;你说他们应该使用select join&#39;添加但对于什么,以及如何适应,并不是显而易见的。