0
我已經寫了一個過程,並且有多個我已經使用的Sql語句,但是在一個語句中,我被卡住了,所以我的問題出現在下面的查詢中。在我的查詢中有一個名爲ULE.ULE_ORIGINAL_PFS的引用句柄,此引用句柄的值可以是數字或MASTER_DATA_NO_AVAILABLE或INVALID_ENTRY,所以我的要求是每當refnum的值是MASTER_DATA_NO_AVAILABLE或INVALID_ENTRY時,我必須將其視爲' 0'非常好,因爲我很困惑使用DECODE或NVL,所以非常有幫助。想在我的查詢中使用DECODE
SELECT SUM(ORF.ORDER_RELEASE_REFNUM_VALUE)
INTO V_OR_ORIGINAL_PFS
FROM ORDER_RELEASE_REFNUM ORF ,
VIEW_SHIPMENT_ORDER_RELEASE VSOR,
SHIPMENT SH ,
ORDER_RELEASE ORR
WHERE ORF.ORDER_RELEASE_GID = VSOR.ORDER_RELEASE_GID
AND VSOR.SHIPMENT_GID = SH.SHIPMENT_GID
AND ORR.ORDER_RELEASE_GID = ORF.ORDER_RELEASE_GID
AND ORF.ORDER_RELEASE_REFNUM_QUAL_GID = 'ULE.ULE_ORIGINAL_PFS'
AND SH.SHIPMENT_GID = P_SHIPMENT_GID
AND ORR.ORDER_RELEASE_GID IN
(SELECT ORR.ORDER_RELEASE_GID
FROM VIEW_SHIPMENT_ORDER_RELEASE VSOR,
SHIPMENT SH ,
ORDER_RELEASE ORR
WHERE VSOR.ORDER_RELEASE_GID = ORR.ORDER_RELEASE_GID
AND VSOR.SHIPMENT_GID = SH.SHIPMENT_GID
AND SH.SHIPMENT_GID = P_SHIPMENT_GID
AND ORR.ORDER_RELEASE_GID NOT IN
(SELECT ORF.ORDER_RELEASE_GID
FROM VIEW_SHIPMENT_ORDER_RELEASE VSOR,
SHIPMENT SH ,
ORDER_RELEASE_REFNUM ORF
WHERE VSOR.ORDER_RELEASE_GID = ORF.ORDER_RELEASE_GID
AND VSOR.SHIPMENT_GID = SH.SHIPMENT_GID
AND ORF.ORDER_RELEASE_REFNUM_QUAL_GID = 'ULE.ULE_UNPLANNED_ICT'
AND SH.SHIPMENT_GID = P_SHIPMENT_GID
)
);
你在找什麼東西像這樣解碼(ULE_ORIGINAL_PFS,'MASTER_DATA_NO_AVAILABLE',0,'INVALID_ENTRY',0,ULE_ORIGINAL_PFS)'?雖然實際上無法理解您的查詢邏輯.... – Plirkee