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;
uj5u.com熱心網友回復:
說一下你想實作什么樣的功能。轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/86407.html
標籤:開發
上一篇:Oracle 11G臨時表空間
