一条SQL语句的优化,在线等(急),多谢各位了.
SELECT A.WAREHOUSECD WAREHOUSECD,
A.COMPANYCD COMPANYCD,
A.SHIPDATE SHIPDATE,
A.DOCUMENTNUMBER DOCUMENTNUMBERA,
A.DELIVNAME DELIVNAME,
A.SSZIPCODE SSZIPCODE,
(SELECT T.TRANSAMT
FROM EDIFREINVRATEMASTERRDC T
WHERE T.BUSI = TRIM(A.COMPANYCD) AND
T.RATEYY = TO_CHAR(A.SHIPDATE, 'YYYY ') AND
T.SSZIPCODE = TRIM(A.SSZIPCODE) AND ROWNUM = 1) TRANSAMT,
A.NOTES NOTES,
A.SOTYPE SOTYPE,
DECODE(B.URGENT, 'Y ', B.URGENT, 'N ') URGENT,
B.LIACODE LIABILITYCD,
B.REACODE REASONCD,
B.MATERIAL ITEMCD,
B.ACTQUANTITY ACTQUANTITY,
B.ACCQUANTITY ACCQUANTITY,
FX_GETTOTMEASUREMENT(B.MESSAGERECEIVERIDENTIFIER,
B.MATERIAL,
B.ACTQUANTITY) CBM,
FX_GETTOTMEASUREMENT(B.MESSAGERECEIVERIDENTIFIER,
B.MATERIAL,
B.ACCQUANTITY) ACC_CBM,
Z.BASE_AMT BASE_AMT,
Z.BASE_AMT /
nvl((select count(*)
FROM EDIPODDLYRDC W, EDIPODDLYMATLISTRDC X
WHERE W.MESSAGENUMBER = X.MESSAGENUMBER