日期:2014-05-17  浏览次数:20781 次

菜鸟的问题:修改数据,存储过程怎么写,请高手指点
表名:A
字段:B,C,D,E

想要更新表A中E=X的记录,要求存储过程中先删除E=X的这条记录,然后再以新记录进行追加,但追加时需要判断B的值,如果B=0,则B=0,C=0,D=Y,
如果B不为0,则B=1,C=CC,   D=Y。

请高手指点一下,谢谢~

------解决方案--------------------
procedure ****
(
params
)
as
temb a.b%type := ' ';
teme a.e%type := ' ';
begin
取出值进入临时变量
declare
cursor cur is
select b ,e from a;
row cur%rowdata;
begin
if cur%isopen = false then
open cur;
fetch cur into row;
exit when cur%notfound;
temb := row.b;
teme := row.e;
如果E字段的字满足条件,删除该条,自动去取另一条
if teme = 'x ' then
delete from a where e = 'x ';
commit;
else
if tem = '0 ' then
*****;
else
*****;
end if;
end if;
end;
end;
静态邮标的属性记不清了,呵呵,大致是这样的一个过程吧
------解决方案--------------------
同上