使用ODBC连接到DB2实例,并使用下面的select语句返回以下错误:
错误代码:-122 SQL状态:42803
有人可以帮我识别下面代码的哪一部分引发错误
SELECT
SAB089.ZCREPRE0.CREPREDOS as ContractCode,
SAB089.ZCLIENA0.CLIENACLI as ConsentCode,
SAB089.ZCREPRE0.CREPREAGE as Branch,
(case
when SAB089.ZCREPRE0.CREPRECTA='7' then 'Open'
when SAB089.ZCREPRE0.CREPRECTA='8' then 'Closed'
end) as PhaseOfContract,
(case
when SAB089.ZCREPRE0.CREPRECTA='6' then 'GrantedButNotActivated'
when SAB089.ZCREPRE0.CREPRECTA='7' then 'GrantedAndActivated'
when SAB089.ZCREPRE0.CREPRECTA='8' then 'SettledOnTime'
end) as ContractStatus,
'Installment' as TypeOfContract,
(case
when SAB089.ZCREPRE0.CREPRENAT = '757' then 'Vehicule'
when SAB089.ZCREPRE0.CREPRENAT = '756' then 'Equipement'
when SAB089.ZCREPRE0.CREPRENAT = '758' then 'Immobilier'
end) as PurposeOfFinancing,
SAB089.ZCREDOS0.CREDOSDEV as CurrencyOfContract,
Cast(SAB089.ZCREDOS0.CREDOSMNT as DECIMAL(19,2)) as TotalAmount,
SAB089.ZCREAVI0.CREAVIMON as InstallmentAmount,
SAB089.ZCREPLA0.CREPLANPC as NumberOfInstallments,
Cast(SAB089.ZCREPRE0.CREPRECAP as DECIMAL(19,2)) as OutstandingAmount,
Cast(SAB089.ZIMPECH0.IMPECHMON as DECIMAL(19,2)) as PastDueAmount,
SAB089.ZIMPECH0.IMPECHDTI as PastDueDays,
SAB089.ZIMPDOS0.IMPDOSECH as NumberOfDueInstallments,
Cast(SUM(SAB089.ZCREAVI0.CREAVIMON + SAB089.ZCREAVI0.CREAVIMIN + SAB089.ZCREAVI0.CREAVITVA + SAB089.ZCREAVI0.CREAVIAM1)as DECIMAL(19,2)) as TotalMonthlyPayment,
(case
when SAB089.ZCREPLA0.CREPLAPCA = 'U' then 'FinalDay'
when SAB089.ZCREPLA0.CREPLAPCA = 'M' then 'Days30'
when SAB089.ZCREPLA0.CREPLAPCA = 'T' then 'Days90'
when SAB089.ZCREPLA0.CREPLAPCA = 'S' then 'Days120'
when SAB089.ZCREPLA0.CREPLAPCA = 'A' then 'Days360'
end)
as PaymentPeriodicity,
{fn substring(SAB089.ZCREMAD0.CREMADDMD,5,2)} || '-' || {fn substring(SAB089.ZCREMAD0.CREMADDMD,3,2)} || '-' || {fn substring(SAB089.ZCREMAD0.CREMADDMD,1,2)} as StartDate,
{fn substring(SAB089.ZCREAVI0.CREAVIECH,5,2)} || '-' || {fn substring(SAB089.ZCREAVI0.CREAVIECH,3,2)} || '-' || {fn substring(SAB089.ZCREAVI0.CREAVIECH,1,2)} as RealEndDate
FROM
SAB089.ZCREAVI0, SAB089.ZIMPDOS0, SAB089.ZIMPECH0, SAB089.ZCREMAD0
INNER JOIN SAB089.ZCREPRE0 ON (SAB089.ZCREPRE0.CREPREETA=SAB089.ZCREMAD0.CREMADETA and SAB089.ZCREPRE0.CREPREAGE=SAB089.ZCREMAD0.CREMADAGE and SAB089.ZCREPRE0.CREPRESCE=SAB089.ZCREMAD0.CREMADSER and SAB089.ZCREPRE0.CREPRESSE=SAB089.ZCREMAD0.CREMADSSE and SAB089.ZCREPRE0.CREPREDOS=SAB089.ZCREMAD0.CREMADDOS and SAB089.ZCREPRE0.CREPREPRE=SAB089.ZCREMAD0.CREMADPRE)
INNER JOIN SAB089.ZCREPLA0 ON (SAB089.ZCREPLA0.CREPLAETA=SAB089.ZCREPRE0.CREPREETA and SAB089.ZCREPLA0.CREPLAAGE=SAB089.ZCREPRE0.CREPREAGE and SAB089.ZCREPLA0.CREPLASER=SAB089.ZCREPRE0.CREPRESCE and SAB089.ZCREPLA0.CREPLASSE=SAB089.ZCREPRE0.CREPRESSE and SAB089.ZCREPLA0.CREPLADOS=SAB089.ZCREPRE0.CREPREDOS and SAB089.ZCREPLA0.CREPLAPRE=SAB089.ZCREPRE0.CREPREPRE)
INNER JOIN SAB089.ZCREDOS0 ON (SAB089.ZCREDOS0.CREDOSETA=SAB089.ZCREPRE0.CREPREETA and SAB089.ZCREDOS0.CREDOSAGE=SAB089.ZCREPRE0.CREPREAGE and SAB089.ZCREDOS0.CREDOSSER=SAB089.ZCREPRE0.CREPRESCE and SAB089.ZCREDOS0.CREDOSSSE=SAB089.ZCREPRE0.CREPRESSE and SAB089.ZCREDOS0.CREDOSDOS=SAB089.ZCREPRE0.CREPREDOS)
INNER JOIN SAB089.ZCREEMP0 ON (SAB089.ZCREDOS0.CREDOSETA=SAB089.ZCREEMP0.CREEMPETA and SAB089.ZCREDOS0.CREDOSAGE=SAB089.ZCREEMP0.CREEMPAGE and SAB089.ZCREDOS0.CREDOSSER=SAB089.ZCREEMP0.CREEMPSER and SAB089.ZCREDOS0.CREDOSSSE=SAB089.ZCREEMP0.CREEMPSSE and SAB089.ZCREDOS0.CREDOSDOS=SAB089.ZCREEMP0.CREEMPDOS)
INNER JOIN SAB089.ZCLIENA0 ON (SAB089.ZCLIENA0.CLIENACLI=SAB089.ZCREEMP0.CREEMPNCL)
LEFT OUTER JOIN SAB089.X89ADRESSE ON (SAB089.X89ADRESSE.ADRESCLI=SAB089.ZCLIENA0.CLIENACLI)
INNER JOIN SAB089.ZCLIENB0 ON (SAB089.ZCLIENA0.CLIENAETB=SAB089.ZCLIENB0.CLIENBETB and SAB089.ZCLIENA0.CLIENACLI=SAB089.ZCLIENB0.CLIENBCLI)
INNER JOIN SAB089.ZCLIENC0 ON (SAB089.ZCLIENA0.CLIENAETB=SAB089.ZCLIENC0.CLIENCETB and SAB089.ZCLIENA0.CLIENACLI=SAB089.ZCLIENC0.CLIENCCLI)
LEFT OUTER JOIN SAB089.ZCLILIB0 ON (SAB089.ZCLILIB0.CLILIBCLI=SAB089.ZCLIENA0.CLIENACLI)
WHERE
(
{fn substring(SAB089.ZCLILIB0.CLILIBVAL,13,1)} = 'O'
AND SAB089.ZCREMAD0.CREMADDMD >= '1120101'
AND SAB089.ZCREPRE0.CREPRECTA IN (6, 7, 8)
AND SAB089.ZCLIENA0.CLIENADOU = 'N'
)