Search code examples
sqloracle-databaseora-00907dbvisualizer

ORA-00907: missing right parenthesis 2


I am trying to execute this query to get some results in db-visualizer, but I keep getting the following response:

Response:

[Error Code: 907, SQL State: 42000] ORA-00907: missing right parenthesis

Edited Query:

SELECT * FROM (
    SELECT 
    e.*, clt_add_l1, clt_add_l2, clt_city, clt_prst_cd, clt_pszp_cd 
    FROM     Staging.db_&tablename_v._match e,  client.clt_address ca, client.clt_add_usg au 
    WHERE    substr(match_desc,1,2) = '00' 
    and e.clt_ofc_no=au.clt_ofc_no(+) 
    and e.clt_no=au.clt_no(+) 
    and au.clt_ofc_no=ca.clt_ofc_no(+) 
    and au.clt_add_key=ca.clt_add_key(+) 
    and au.clt_add_type(+)='PRI' 
    UNION ALL
    SELECT 
    e.*, clt_add_l1, clt_add_l2, clt_city, clt_prst_cd, clt_pszp_cd 
    FROM     Staging.db_&tablename_v._match e,  staging.clt_address_cp au 
    WHERE    substr(match_desc,1,2) in ('01','02') 
    and e.namadd_no = au.namadd_no(+) 
) foo ORDER BY match_desc, seq_no;

Solution

  • The problem was &tablename_v. needed to be removed and a table name (i.e. DATES) was supposed to be inserted in place. I tried it and it worked.

    But thank you all for your help! It is greatly appreciated :)