我有CAPTURED_DATA_01表,其中包含以下数据:
SUBSCRIPTION_ID
201502031336444606
和WF_WORKFLOW表,其中包含以下数据:
SUBSCRIPTION ID
201502031337330387
201502031336545536
201502031336444606
我有WF_WORKFLOW表,其中我使用子查询来获取SUBSCRIPTION_ID的结果。子查询运行正常。我想将此SUBSCRIPTION_ID的结果与CAPTURED_DATA_01表的SUBSCRIPTION_ID进行比较并仅返回结果,使得SUBSCRIPTION_ID为WF_WORKKFLOW表大于CAPTURED_DATA_01表的SUBSCRIPTION_ID。因此,如表中数据所示,WF_WORKFLOW的SUBSCRIPTION_ID返回包含数据201502031336545536
和201502031337330387
的2行。
我使用了以下查询,但它返回null。我不知道我在查询中的条件错误在哪里。子查询没有问题,因为我测试过它。问题只出在我比较结果的where条件。我认为应该正确定义。
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
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)