请问在存储过程中如何建立日志表并且自动更新

scf_live 2017-08-04 01:24:56

create or replace procedure proc_transfer(v_incard in varchar2,
v_outcard in varchar2,
v_pass in varchar2,
v_money in varchar2,
v_result out varchar2)

is
v_inid number:=0 ;
v_outid number:=0 ;
v_inpass number:=0 ;
v_temp_money number:=0 ;
user_no_find exception;
pass_error exception;
money_no_enough exception;
begin
select count(*) into v_inid from account t where t.name =v_incard;
if v_inid =0 then
raise user_no_find;
end if;
select count(*) into v_outid from account t where t.name = v_outcard;
if v_outid =0 then
raise user_no_find;
end if;
select count(*) into v_inpass from account t where t.name =v_incard and t.pass=v_pass;
if v_inpass =0 then
raise pass_error ;
end if;
select t.money into v_temp_money from account t where t.name =v_incard;
if v_temp_money<v_money then
raise money_no_enough;
end if;

update account t set t.money =t.money+v_money where t.name =v_outcard;
update account t set t.money =t.money-v_money where t.name=v_incard;
dbms_output.put_line(0');
commit;
exception
when user_no_find then
rollback;
dbms_output.put_line('0');
commit;
when pass_error then
rollback;
dbms_output.put_line('8);
commit;
end;
...全文
165 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
卖水果的net 2017-08-04
  • 打赏
  • 举报
回复
说一下你想实现什么样的功能。

17,082

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧