error 3706 in query execution

General
Enthusiast

error 3706 in query execution

Hi All

running the query in TERADATA env. 12.0  i got the following message:

3706 syntax error:expected something between a string or unicode character literal and '=' 

select

DISTINCT DT_CNTB

,ID_ENT_GSTR

,ID_ENT_SGNLN

,ID_TP_FLS

,ID_CLNT_CR

,NDG_SGT

,CD_FNMN

,case

when ID_CLS_DATO='31' then 'AM_ACRDT'

when ID_CLS_DATO='32' then 'ACRDT_OPRV'

when ID_CLS_DATO='33' then 'AM_UTLZT'

when ID_CLS_DATO='39' then 'AM_SCNFN'

ELSE ID_CLS_DATO

END ID_CLS_DATO

, 'AM_FNMN_ACRDT' = case when ID_CLS_DATO='31' then AM_FNMN END

, 'AM_FNMN_ACRDT_OPRV' = case when ID_CLS_DATO='32' then AM_FNMN END

, 'AM_FNMN_UTLZT' = case when ID_CLS_DATO='33' then AM_FNMN END

, 'AM_FNMN_SCNFN' = case when ID_CLS_DATO='39' then AM_FNMN END

--, SUM(AM_FNMN)/2 AS TOT_AMNT_FNMN

from

( SELECT CD_BNC, ID_CLNT_CR, ID_ENT_GSTR, ID_ENT_SGNLN, DT_NZ_VLDT_RLZ, NDG_SGT, DT_FN_VLDT_RLZ

FROM DXDWH_DB.DWH_RLZ_CLNT_SGT

where (ID_ENT_GSTR='1' AND ID_ENT_SGNLN='1')

and NDG_SGT='302297949' ) aaa

left join

(

select ID_CLNT_CR_AFDT, CD_FNMN, CD_FNMN_GRNTT, DT_CNTB, AM_FNMN, ID_TP_FLS, ID_CLS_DATO

FROM DXDWH_DB.DWH_SGNLZ_DATI_DA_CR

where DT_CNTB='2014-07-31'

AND ID_TP_FLS='5'

AND ID_CLS_DATO IN ('31','32','33','39') -- IMPORTI NEL PERIMETRO CONTROLLI

)

xxx

on ID_CLNT_CR=ID_CLNT_CR_AFDT

thanks' for your suggestion

1 REPLY
Enthusiast

Re: error 3706 in query execution

thgank's for all, i solved the matter......

changing

, 'AM_FNMN_ACRDT' = case when ID_CLS_DATO='31' then AM_FNMN END

, 'AM_FNMN_ACRDT_OPRV' = case when ID_CLS_DATO='32' then AM_FNMN END

, 'AM_FNMN_UTLZT' = case when ID_CLS_DATO='33' then AM_FNMN END

, 'AM_FNMN_SCNFN' = case when ID_CLS_DATO='39' then AM_FNMN END

with the correct syntax

, case when (ID_CLS_DATO='31') then AM_FNMN END AM_FNMN_ACRDT

, case when (ID_CLS_DATO='32') then AM_FNMN END AM_FNMN_ACRDT_OPRV

, case when (ID_CLS_DATO='33') then AM_FNMN END AM_FNMN_UTLZT

, case when (ID_CLS_DATO='39') then AM_FNMN END AM_FNMN_SCNFN

thank's once more

Pio