Oracle 12c PLSQL 合并错误
Oracle 12c PLSQL MERGE error
下面的代码片段来自我的一个较大的程序。当我在 TOAD 中手动执行此过程时,它可以正常运行,正如我所期望的那样。
我现在正试图将它放入用户的表单中 - 但是当我尝试编译它时,我在 MERGE 行收到以下错误:
"Encountered the symbol "INTO" 当期望出现以下情况之一时:
:=.(@%;"
MERGE INTO count_balance cb
USING (select location_code, product_code, closing_stock
from trd_stock_closing ts
where period = gen.add_periods(p_period, -1)
and exists (select null
from ag_product_view
where product_code = ts.product_code
and group_code = 'Q')) cs
ON (cb.location_code = cs.location_code AND cb.product_code = cs.product_code)
WHEN MATCHED THEN
UPDATE SET cb.opening_stock = cs.closing_stock
WHEN NOT MATCHED THEN
INSERT (location_code, product_code, opening_stock)
VALUES (cs.location_code, cs.product_code, cs.closing_stock);
有人可以建议吗?
您似乎在尝试使用旧的 Oracle*Forms,它根本不支持 MERGE 语句。尝试使用较新版本的 Forms 或将此代码包装到存储过程中。
下面的代码片段来自我的一个较大的程序。当我在 TOAD 中手动执行此过程时,它可以正常运行,正如我所期望的那样。
我现在正试图将它放入用户的表单中 - 但是当我尝试编译它时,我在 MERGE 行收到以下错误: "Encountered the symbol "INTO" 当期望出现以下情况之一时: :=.(@%;"
MERGE INTO count_balance cb
USING (select location_code, product_code, closing_stock
from trd_stock_closing ts
where period = gen.add_periods(p_period, -1)
and exists (select null
from ag_product_view
where product_code = ts.product_code
and group_code = 'Q')) cs
ON (cb.location_code = cs.location_code AND cb.product_code = cs.product_code)
WHEN MATCHED THEN
UPDATE SET cb.opening_stock = cs.closing_stock
WHEN NOT MATCHED THEN
INSERT (location_code, product_code, opening_stock)
VALUES (cs.location_code, cs.product_code, cs.closing_stock);
有人可以建议吗?
您似乎在尝试使用旧的 Oracle*Forms,它根本不支持 MERGE 语句。尝试使用较新版本的 Forms 或将此代码包装到存储过程中。