在oracle要写这样一个存储过程,不知为什么老是报错,求解答?

2025-03-24 01:31:37
推荐回答(2个)
回答1:

那段update语句改成如下语句
merge priceplan r
using ductprice p
on (r.ncorp=p.ncorp and r.noid = p.noid and r.start=p.nstart and r.nsta = 2021)
when matched then
update
set p.nprice= plan
;

回答2:

Oracle中没有Update from 的语法

create or replace procedure priceplanpro
(nstart in number,noid in number,plan in number)
as
begin
if nstart > 0 then
update ductprice p set p.nprice= plan
where noid = noid and start=nstart and nsta = 2021
and exists(select * from priceplan r where r.ncorp=p.ncorp) ;
end if;
exception
when no_data_found then
dbms_output.put_line('数据不存在!');
end priceplanpro;