0

我正在尝试在 oracle 11g 中运行此代码并收到此错误消息

// 第 4 行出错 ORA-00936: 缺少表达式 // 错误是 'j' @ "FROM JOB j," //

这是代码:

WITH sq AS (SELECT j.measurenumber, j.enterdate, trunc(c.passedoffdate) PassedOffDate, 
d.yearid, d.weekid, d.quarterid, c, estimatesqft, e.totalamount EstimateTotal, 
j.storenumber, c.quoteid, c.measurebitfield, c.soldstatus, 
FROM JOB j, JOB_CLOSE c, dash_reportweek d, estimate_measure em,
estimate e,
WHERE   measurenumber = c.measurenumber
                AND j.measurenumber = em.measurenumber
                AND em.estimateid = e.estimateid
                AND j.measurenumber = o.measurenumber(+)
                AND o.measurenumber IS NULL
                AND j.enterdate BETWEEN d.startdate AND d.enddate
                AND d.yearid = 2018 AND c.measurebitfield = 1
                AND d.quarterid = 2)
SELECT sq.MEASURENUMBER,
       SQ.ENTERDATE, 
       SQ.YEARID,
       SQ.WEEKID,
       SQ.QUARTERID,
       SQ.PASSEDOFFDATE,
       SQ.ESTIMATESQFT,
       SQ.ESTIMATETOTAL,
       SQ.STORENUMBER,
       SQ.QUOTEID,
       QUOTEDOLLARAMMOUNT,
       SQFT, 
       SQ.SOLDSTATUS
  FROM SQ,
       (  SELECT sq.measurenumber, SUM (unitprice) sqft
            FROM sq, quoteitementry qi
           WHERE sq.quoteid = qi.quoteid AND qi.quoteelementid = 25007
        GROUP BY sq.measurenumber) v1,
       (  SELECT sq.measurenumber,
                 SUM (qi.quantity * qi.UNITPRICE) QuoteDollarAmmount
            FROM sq, quoteitementry qi
           WHERE sq.quoteid = qi.quoteid AND qi.active = 'T'
        GROUP BY sq.measurenumber) v2
WHERE     sq.measurenumber = v2.measurenumber(+)
       AND sq.measurenumber = v1.measurenumber(+);
4

1 回答 1

1

如果您仔细查看代码,请在评论中突出显示的那一点...

 c.soldstatus, 
 FROM JOB j

...你会注意到你有一个尾随逗号。查询投影中的最后一列后跟 FROM 而不是逗号。因为你有一个逗号 Oracle 期望另一个列被命名。因此例外。

于 2018-06-16T23:51:04.913 回答