我有以下书面查询,但我收到一条错误消息
即FROM KEY WORD NOT FOUND
有什么想法吗?
SELECT H.AGG_HEADER_SEQ,
H.PRICE,
D.AGG_DETAIL_SEQ,
D.MONEY_UNITS,
D.CASH_VALUE,
D.UNIT_VALUE,
D.MONEY_UNITS_VALUE,
CASE
WHEN D.MONEY_UNITS = 'U' THEN (D.UNIT_VALUE * H.PRICE) / 1
WHEN D.MONEY_UNITS = 'M' THEN D.UNIT_VALUE
ELSE 0
END
AS CASH_VALUE_CALC INTO CAL_CASH_VALUE,
CASE
WHEN D.MONEY_UNITS = 'U' THEN D.CASH_VALUE
WHEN D.MONEY_UNITS = 'M' THEN (D.CASH_VALUE * H.PRICE) / 1
ELSE 0
END
AS UNIT_VALUE_CALC INTO CAL_UNIT_VALUE
FROM FCS.ORDTRAN_NOM_AGG_HEADER H
JOIN FCS.ORDTRAN_NOM_AGG_DETAIL D
ON H.AGG_HEADER_SEQ = D.AGG_HEADER_SEQ
WHERE H.AGG_HEADER_SEQ = 5379 AND D.ALLOW_PRICING = 'Y';
答案 0 :(得分:0)
你必须摆脱INTO CAL_CASH_VALUE
:
SELECT H.AGG_HEADER_SEQ, H.PRICE, D.AGG_DETAIL_SEQ, D.MONEY_UNITS, D.CASH_VALUE, D.UNIT_VALUE, D.MONEY_UNITS_VALUE, CASE WHEN D.MONEY_UNITS = 'U' THEN (D.UNIT_VALUE * H.PRICE) / 1 WHEN D.MONEY_UNITS = 'M' THEN D.UNIT_VALUE ELSE 0 END AS CASH_VALUE_CALCINTO CAL_CASH_VALUE, CASE WHEN D.MONEY_UNITS = 'U' THEN D.CASH_VALUE WHEN D.MONEY_UNITS = 'M' THEN (D.CASH_VALUE * H.PRICE) / 1 ELSE 0 END AS UNIT_VALUE_CALC INTO CAL_UNIT_VALUE FROM FCS.ORDTRAN_NOM_AGG_HEADER H JOIN FCS.ORDTRAN_NOM_AGG_DETAIL D ON H.AGG_HEADER_SEQ = D.AGG_HEADER_SEQ WHERE H.AGG_HEADER_SEQ = 5379 AND D.ALLOW_PRICING = 'Y';
如果要对PL / SQL使用此查询,则必须将其放在FROM
子句的上方,但必须为其他字段添加变量。