【问题标题】:ORA-00936:missing expression -- oracleORA-00936: 缺少表达式 -- oracle
【发布时间】:2017-08-31 01:50:42
【问题描述】:

虽然我在 Stackoverflow 中找到了一些相关的问题:

ORA-00936: missing expression oracle

ORA-00936: missing expression Oracle Apex

但这些不适合我的问题:

(SELECT t_1.oi1name OI1NAME 
FROM ( select oi1.name oi1name, oi.name oname, b.prodesc, b.foundtime, b.occurrencetime, b.divisionproject, b.pilenumber, b.constructionteam, b.progress, h.pk_group 
from zspm_qa_monthlyreport_b b 
left outer join zspm_qa_monthlyreport_h h on b.pk_monthlyreport_h = h.pk_monthlyreport_h 
left outer join org_itemorg oi on oi.pk_itemorg = h.pk_org 
left outer join org_itemorg oi1 on oi1.pk_itemorg = oi.pk_fatherorg 
where h.dr = 0 and h.billstatus = 1 and b.dr = 0 
and oi.code like CONCAT ( ( select code from org_itemorg where pk_itemorg in () ), '%' ) and h.def1 = '2016-01' ) t_1 
WHERE t_1.pk_group = '0001A2100000000007QL')

这是我查询的sql代码,但我不知道问题出在哪里。

【问题讨论】:

    标签: sql oracle


    【解决方案1】:

    in 列表为空。我认为这是不允许的。

    更重要的是,您可能想要这样的逻辑:

    where . . . and
          exists (select 1
                  from org_itemorg oio
                  where pk_itemorg in (. . .) and
                        oi.code like oio.code || '%'
                 ) and
          h.def1 = '2016-01'
    

    您的子查询可以返回多行,这在您运行查询时会出现问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多