Einfügen von CTE
P粉573809727
2023-08-24 10:57:10
<p><pre class="brush:php;toolbar:false;">MIT DTL AS
(CMPI_CODE AUSWÄHLEN,
CMN_CDTY_MTRL,
CMI_WT_FACTOR,
CMI_CNTRCT_RATE,
'PL',
PRESENT_PRICE,
TRM_CODE,
ROUND(((NVL(PRESENT_PRICE,1)*CMI_WT_FACTOR) / CMI_CNTRCT_RATE),2) AS PL_FACTOR
VON VW_CMD_MATERIAL WO TRM_CODE = 41)
INSERT iNTO IPA_PRCADJ_HDR(TRM_CODE,IPAPH_ADJ_FACTOR,IPAPH_AMT_CUR,IPAPH_REMARKS)
SELECT TRM_CODE,SUM(PL_FACTOR) AS PL_FACTOR,((SUM(PL_FACTOR)*10)) AS AMT_CUR,'asdf'
FROM DTL GROUP BY (TRM_CODE);</pre>
<p>显示错误 <code>ORA-00928: 缺少 SELECT 关键字</code></p>
似乎 Insert 不能用作公用表表达式之后的第一个语句。试试这个,
这是从 CTE 插入表的语法: