DB2 sql問題 |
尚未結案
|
poe
一般會員 發表:1 回覆:0 積分:0 註冊:2004-05-13 發送簡訊給我 |
小弟有一sql問題..
我用的數據庫是[DB2/400]
以下有兩段SQL,其中第一段是可以順利執行,而第二段就有錯誤..
錯誤提示為
EDBEngineError with message 'Key violation. [IBM]{Client Access Express ODBC Driver (32-bit)][DB2/400 SQL]SQL0420 - Character in CAST argument not valid.'. 請各位高手幫幫忙... 1. SELECT FRFC.FCNUMFAC, FRPF.CDNUMDOC1, FRPF.CDNUMDOC2, FRPC.PCNUMORD1, FRPCA.PCPN, FRPF.PFCODDEV, FRPF.PFQTEFAC, FRPF.PFPU, FRFC.FCA4, FRFC.FCMM, FRFC.FCJJ
FROM FRFC, FRPF, FRPCA, FRPC
WHERE ((((FRPF.PCNUMORD1=FRPCA.PCNUMORD1) AND ((FRPF.CDNUMDOC1=FRPCA.PCNUMDOC1) AND (FRPF.CDNUMDOC2=FRPCA.PCNUMDOC2))) AND
(FRPC.PCNUMORD1=FRPCA.PCNUMORD1) AND ((FRPC.PCNUMDOC1=FRPCA.PCNUMDOC1) AND (FRPC.PCNUMDOC2=FRPCA.PCNUMDOC2))) AND
FRFC.FCNUMFAC=FRPF.FCNUMFAC AND FRFC.FCCODFOU=FRPF.FCCODFOU AND (cast(FRFC.FCA4 as integer)*100 cast(FRFC.FCMM as integer)) between :dstart and :dend)
ORDER BY FRFC.FCA4, FRFC.FCMM, FRFC.FCJJ 2. SELECT FRTR.TRNOM, FRFC.FCNUMFAC, FRPF.CDNUMDOC1, FRPF.CDNUMDOC2, FRPF.PFCODDEV, SUM(FRPF.PFPU * FRPF.PFQTEFAC),
COUNT( FRPF.PCNUMORD1), FRFC.FCA4, FRFC.FCMM, FRFC.FCJJ
FROM FRFC, FRPF, FRTR, FRPCA
WHERE ((((FRPF.CDNUMDOC1=FRPCA.PCNUMDOC1) AND (FRPF.CDNUMDOC2=FRPCA.PCNUMDOC2)
) AND (FRPF.PCNUMORD1=FRPCA.PCNUMORD1)) AND FRFC.FCNUMFAC=FRPF.FCNUMFAC AND FRFC.FCCODFOU=FRPF.FCCODFOU AND FRPF.FCCODFOU=FRTR.TRCODFOU AND
(cast(FRFC.FCA4 as integer) * 100 cast(FRFC.FCMM as integer)) between :dstart and :dend)
GROUP BY FRFC.FCNUMFAC, FRPF.CDNUMDOC1, FRPF.CDNUMDOC2, FRPF.PFCODDEV, FRTR.TRNOM, FRFC.FCA4, FRFC.FCMM, FRFC.FCJJ
ORDER BY FRFC.FCA4, FRFC.FCMM, FRFC.FCJJ
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |