Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 14 Jan 2009 @ 15:14:22 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Syntax error: expected something between '(' and the 'SELECT' keyword
 
From:   geethabhatt

I am getting following error msg when I try to run this query. Please advice. Thank you for the help.

error msg:

[Macromedia][SequeLink JDBC Driver][ODBC Socket][NCR][ODBC Teradata Driver][Teradata Database] Syntax error: expected something between '(' and the 'SELECT' keyword.


query:

     SELECT (
       a.OPR_ACCT_NR,
       a.FINAL_MATURITY_DT,
       m.END_OF_DRAW_DISP_CD,
       a.PORTFOLIO_CD,
       a.ESTM_MATURITY_DT EODDate,
       a.LOAN_TYPE_CD,
       m.CHRG_OFF_RCVRY_CD,
       m.Collectability_CD,
       a.CS_OVERRIDE_CD,
       m.PAST_DUE_AM,
       a.FINAL_MATURITY_DT,
       (substr(a.OPR_ACCT_NR,4,10)) UnivNum,

     ((current_date) - (a.ESTM_MATURITY_DT)) DPD,

       CASE
        WHEN m.PAST_DUE_DT IS NULL THEN 0
        ELSE ((Current_Date) - (m.PAST_DUE_DT))
       END Past_Due_Days,
       m.CURRENT_BAL_AM,
       a.CTP_CD,
       m.CTP_REASON_CD,
       a.CTP_DT,
       (COALESCE((SELECT
         (COALESCE(SUM(N.PRIN_BAL_AM + N.MISC_AM + N.INT_CHRG_AM),0) ))
        FROM
         HEIDS.DLY_ST_MONEY N
        WHERE
         N.CUST_ACCT_ID = A.CUST_ACCT_ID
         AND N.TRAN_CD IN ('30A', '30I', '30C')
         AND (N.PROCESS_DT = (SELECT (MAX(N2.PROCESS_DT)))
          FROM
           HEIDS.DLY_ST_MONEY N2
          WHERE
           N2.CUST_ACCT_ID = N.CUST_ACCT_ID
           AND N2.TRAN_CD IN ('30A', '30I', '30C'))
         ) ,0) PmtProcAM,
        (
        SELECT
         (MAX(N.PROCESS_DT))
        FROM
         HEIDS.DLY_ST_MONEY N
        WHERE
         N.CUST_ACCT_ID = A.CUST_ACCT_ID
         AND N.TRAN_CD IN ('30A', '30I', '30C')
        ) PmtProcDate,
       '' BK_File_Date
     FROM
       HEIDS.DLY_ACCOUNT a,
       HEIDS.DLY_ACCOUNT_MSR m,
       HEIDS.DLY_ACCT_CUSTOMER c

     WHERE
        a.CUST_ACCT_ID = m.CUST_ACCT_ID
       AND a.CUST_ACCT_ID = c.CUST_ACCT_ID
       AND a.ESTM_MATURITY_DT < Current_Date
       AND m.ACCT_STATUS_CD = 'OPEN'
       AND a.PORTFOLIO_CD IN('HEQ','PCM')
       AND a.LOAN_TYPE_CD = '8'
       AND m.CHRG_OFF_RCVRY_CD <> '0'

       
       AND (
        ('#EVENT#' = 'Bankruptcy' AND m.CHRG_OFF_RCVRY_CD = 'B' AND
     m.Collectability_CD NOT IN ('MO', 'MS', 'MB', 'FO', 'FS', 'FB', 'TO',
     'TS', 'TB', 'F9'))
        OR
        ('#EVENT#' = 'Foreclosure' AND m.CHRG_OFF_RCVRY_CD = 'F' AND
     m.Collectability_CD <> 'F9')
        OR
        ('#EVENT#' = 'Pre-foreclosure' AND m.Collectability_CD = 'F9')
        OR
        ('#EVENT#' = 'Other' AND m.CHRG_OFF_RCVRY_CD NOT IN ('F', 'B') AND
     m.Collectability_CD <> 'F9')
        )
       

     ORDER BY a.ESTM_MATURITY_DT
     )


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016