ORA-9005:缺少关键字

时间:2016-01-21 17:40:24

标签: sql oracle oracle10g keyword

当我尝试执行以下查询时,我收到了ORA-9005:缺少关键字错误。

select a.OBJID,
       A.TITLE,
       a.id_number,
       a.creation_time,
       a.case_reporter2contact,
       a.x_rev_esc_prim_reason,
       a.x_rev_esc_sec_reason,
       a.x_esc_third_reason,
       b.x_channel_source,
       b.x_verification,
       b.x_followup_status,
       b.x_saves_status,
       b.x_saves_reason,
       b.x_cust_mislead_flag,
       b.x_cust_mislead_reason,
       b.x_create_dt,
       b.x_update_dt
  from table_case a, table_x_saves_case_info b
 INNER JOIN (SELECT case_reporter2contact,
                    MAX(trunc(creation_time)) as latest_date
               FROM table_case
              WHERE calltype2gbst_elm = '268436012'
                AND x_activity_code = 'DO Drop Off'
              GROUP BY case_reporter2contact) as q
    ON a.case_reporter2contact = q.case_reporter2contact
   and q.latest_date > trunc(a.creation_time)
 where a.objid = b.x_saves_case_info2case
   and a.x_esc_primary_reason = 'Rental Inbound'
   and a.x_esc_secondary_reason in ('Buy-Out', 'Pick-Up', 'Drop-Off')
   and b.x_channel_source in ('Third Party Call',
                              'Third Party Email',
                              'Third Party Fax',
                              'Third Party Mail')
   and b.x_followup_status in ('2nd Attempt Complete', 'Complete')
 order by b.x_create_dt DESC

它突出了来自

的'AS'

MAX(trunc(creation_time))为latest_date

GROUP BY case_reporter2contact)为q

on oracle 10g

2 个答案:

答案 0 :(得分:0)

在Oracle中,您无法使用" AS"别名表或内联视图时的关键字。

因此您的查询必须是:

var that = this;
// ...
.then(function() { that.method2() })

答案 1 :(得分:0)

select a.OBJID,
       a.TITLE,
       a.id_number,
       a.creation_time,
       a.case_reporter2contact,
       a.x_rev_esc_prim_reason,
       a.x_rev_esc_sec_reason,
       a.x_esc_third_reason,
       b.x_channel_source,
       b.x_verification,
       b.x_followup_status,
       b.x_saves_status,
       b.x_saves_reason,
       b.x_cust_mislead_flag,
       b.x_cust_mislead_reason,
       b.x_create_dt,
       b.x_update_dt
  from table_case a inner join table_x_saves_case_info b on a.objid = b.x_saves_case_info2case
 INNER JOIN (SELECT case_reporter2contact,
                    MAX(trunc(creation_time)) as latest_date
               FROM table_case
              WHERE calltype2gbst_elm = '268436012'
                AND x_activity_code = 'DO Drop Off'
              GROUP BY case_reporter2contact) q
    ON a.case_reporter2contact = q.case_reporter2contact
   and q.latest_date > trunc(a.creation_time)
   where a.calltype2gbst_elm = '268438297'
   and a.x_esc_primary_reason = 'Rental Inbound'
   and a.x_esc_secondary_reason in ('Buy-Out', 'Pick-Up', 'Drop-Off')
   and b.x_channel_source in ('Third Party Call',
                              'Third Party Email',
                              'Third Party Fax',
                              'Third Party Mail')
   and b.x_followup_status in ('2nd Attempt Complete', 'Complete')
 order by b.x_create_dt DESC