oracle 出现错误 ORA-00936: 缺少表达式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14541780/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:24:25  来源:igfitidea点击:

Getting error ORA-00936: missing expression

sqloracleoracle10gora-00936

提问by user1958780

When I trying the below SQL I am getting the error ORA-00936: missing expression. Please help me on this, I want distinct on those to columns in Oracle SQL

当我尝试下面的 SQL 时,我收到错误 ORA-00936:缺少表达式。请帮我解决这个问题,我希望这些与 Oracle SQL 中的列不同

SELECT rr.RPT_QUE_I, 
       DISTINCT (rr.ed_sbmt_m, rr.RPT_RUN_STAT_C),
       rr.rpt_cstm_x,
       rr.rpt_cmplt_m,
       CASE 
         WHEN rr.rpt_run_stat_c = 25453 THEN 'PENDING' 
         WHEN rr.rpt_run_stat_c = 25454 THEN 'ACTIVE' 
         WHEN rr.rpt_run_stat_c = 25455 THEN 'FINISHED' 
         WHEN rr.rpt_run_stat_c = 25458 THEN 'ERROR' 
         WHEN rr.rpt_run_stat_c = 25460 THEN 'SCHEDULED' 
       END,
       cc.pro_sym_I,
       rr.usr_wad_ownr_i 
  FROM audit_REPORT_RUN rr, 
       CLIENT_COMPANY cc
 WHERE rr.ED_SBMT_M > TO_DATE('06/01/2012','mm/dd/yyyy') 
   AND rr.ED_SBMT_M < TO_DATE('07/01/2012','mm/dd/yyyy') 
   AND rr.ORG_I = cc.ORG_I
ORDER BY rr.RPT_QUE_I

回答by ajmalmhd04

You should use DISTINCTkeyword at first after the SELECTkeyword, and remove the parenthesis, or if you need to categorize some of it, use GROUP BYfunctions. hope you're getting the desired result.

DISTINCT关键字后面应该先用SELECT关键字,去掉括号,或者如果需要分类,使用GROUP BY函数。希望你得到想要的结果。