Receive the following error:
[Error Code: 3706, SQL State: 42000] [Teradata Database] [TeraJDBC 14.00.00.13] [Error 3706] [SQLState 42000] Syntax error: expected something between '(' and the 'substr' keyword.
SQL:
SELECT
i.cof_clnt_nbr_id AS CLNT_NBR,
i.cof_cmpny_nbr_id AS CO_NBR,
concat(substr(d.prsn_ssn_nk,0,4), '-', substr(d.prsn_ssn_nk,4,2),'-', substr(d.prsn_ssn_nk,6,4)) AS MAKER_SS,
concat(substr(i.cof_acct_nbr_id,0,4), '-', substr(i.cof_acct_nbr_id,4,2), '-', substr(i.cof_acct_nbr_id,6,13)) AS ACCT_NBR,
d.d_full_nm AS BUS_NM,
d.addr_ln_1 AS ADDR_1,
d.addr_ln_2 AS ADDR_2,
d.addr_city AS CITY,
d.addr_st AS ST_CD,
d.addr_zpcd AS ZIP_CD,
i.cof_lst_repo_dt AS REPO_DT,
i.cof_orig_chgoff_prin_am AS BOX_2_PRIN_OS,
i.cof_sale_procd_am as BOX_4_SALE_PRICE
'YES' as BOX_5_WAS_BORR_LIABLE,
concat(h.veh_yr_nk , '' , h.veh_mk_desc_nk, '', h.veh_mdl_desc_nk) as VEH_DESC
FROM
V_WOFDWVW.V_INT_retl_loan_curr a,
V_WOFDWVW.INT_retl_cust_brdg c,
V_WOFDWVW.INT_prsn d,
V_WOFDWVW.INT_VEH g,
V_WOFDWVW.INT_VEH_MK_MDL h,
V_WOFDWVW.INT_RECOV i
WHERE
a.retl_sk = c.retl_sk
and a.retl_sk = i.recov_sk
and c.prsn_sk = d.prsn_sk
and a.veh_sk = g.veh_sk
and g.veh_mk_mdl_sk = h.veh_mk_mdl_sk
and (a.retl_acct_stat_cd = 3 or a.retl_acct_stat_cd = 4)
and i.cof_chgoff_rsn_cd in ('IR','CR','UR','VR')
and a.retl_clss_cd = 4
and c.prsn_type_in = '3'
and i.cof_lst_repo_dt >= cast('20140101' as date format 'YYYYMMDD')
and i.cof_lst_repo_dt < cast('20150101' as date format 'YYYYMMDD')
and i.cof_sale_procd_dt is not null
and c.dw_end_dt = cast('99991231' as date format 'YYYYMMDD')
ORDER BY 1
Do not understand why I am getting this message when my colleague sent to me and runs it just fine.
[Error Code: 3706, SQL State: 42000] [Teradata Database] [TeraJDBC 14.00.00.13] [Error 3706] [SQLState 42000] Syntax error: expected something between '(' and the 'substr' keyword.
SQL:
SELECT
i.cof_clnt_nbr_id AS CLNT_NBR,
i.cof_cmpny_nbr_id AS CO_NBR,
concat(substr(d.prsn_ssn_nk,0,4), '-', substr(d.prsn_ssn_nk,4,2),'-', substr(d.prsn_ssn_nk,6,4)) AS MAKER_SS,
concat(substr(i.cof_acct_nbr_id,0,4), '-', substr(i.cof_acct_nbr_id,4,2), '-', substr(i.cof_acct_nbr_id,6,13)) AS ACCT_NBR,
d.d_full_nm AS BUS_NM,
d.addr_ln_1 AS ADDR_1,
d.addr_ln_2 AS ADDR_2,
d.addr_city AS CITY,
d.addr_st AS ST_CD,
d.addr_zpcd AS ZIP_CD,
i.cof_lst_repo_dt AS REPO_DT,
i.cof_orig_chgoff_prin_am AS BOX_2_PRIN_OS,
i.cof_sale_procd_am as BOX_4_SALE_PRICE
'YES' as BOX_5_WAS_BORR_LIABLE,
concat(h.veh_yr_nk , '' , h.veh_mk_desc_nk, '', h.veh_mdl_desc_nk) as VEH_DESC
FROM
V_WOFDWVW.V_INT_retl_loan_curr a,
V_WOFDWVW.INT_retl_cust_brdg c,
V_WOFDWVW.INT_prsn d,
V_WOFDWVW.INT_VEH g,
V_WOFDWVW.INT_VEH_MK_MDL h,
V_WOFDWVW.INT_RECOV i
WHERE
a.retl_sk = c.retl_sk
and a.retl_sk = i.recov_sk
and c.prsn_sk = d.prsn_sk
and a.veh_sk = g.veh_sk
and g.veh_mk_mdl_sk = h.veh_mk_mdl_sk
and (a.retl_acct_stat_cd = 3 or a.retl_acct_stat_cd = 4)
and i.cof_chgoff_rsn_cd in ('IR','CR','UR','VR')
and a.retl_clss_cd = 4
and c.prsn_type_in = '3'
and i.cof_lst_repo_dt >= cast('20140101' as date format 'YYYYMMDD')
and i.cof_lst_repo_dt < cast('20150101' as date format 'YYYYMMDD')
and i.cof_sale_procd_dt is not null
and c.dw_end_dt = cast('99991231' as date format 'YYYYMMDD')
ORDER BY 1
Do not understand why I am getting this message when my colleague sent to me and runs it just fine.