我正在尝试在 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(+);