请帮助看看这段过程修改和删除的问题
表
create table CANTEEN
(
RID NUMBER not null,
CNAME VARCHAR2(100),
DISCRIPTION VARCHAR2(1000)
)
过程
create or replace procedure maintain_canteen
(
btype in number,-- 维护类型 1 增加 2 修改 3 删除
rid in number,
cname in varchar2,
discription in varchar2,
bRt_id out number, -- 1 返回当前记录id
bResult out number -- 1 正常 6 未找到相应记录 8 其它错误
) is
-- p_Result number;
begin
-- 维护Canteen表
-- 1 增加
bResult := 1;
bRt_id := Rid;
if btype in (1) then
insert into Canteen(RID,CName,Discription)
values(SQ_Canteen.NEXTVAL,cname,discription);
select max(RID) into bRt_id from Canteen;
end if;
if btype in (2) then
update Canteen t set
t.cname = cname,
t.discription = discription
where t.RId = rid;
end if;
if btype in (3) then
delete from Canteen t
where t.RId = rid;
end if;
commit;
exception
When NO_DATA_FOUND then
bResult := 6;
When OTHERS then
bResult := 8;
rollback;
end maintain_canteen;
问题描述:Oracle9.2,当btype为1时操作正确;当btype为2时出现问题是,没能修改任何记录;当btype为3时会删除所有记录。请问高手问题出现在哪里,谢谢!