没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
create or replace procedure sp_transfer(p_id_from t_account.a_id%type,
p_id_to t_account.a_id%type,
p_money t_account.a_balance%type)
as
v_id_from t_account.a_id%type;
v_lock t_account.a_lock%type;
v_id_to t_account.a_id%type;
v_balance t_account.a_balance%type;
begin
--减去来源帐号的金额
update t_account set a_balance=a_balance-p_money where a_id=p_id_from
return a_balance,a_lock into v_balance,v_lock;
--检查来源帐号是否存在
if(sql%notfound)then
Raise_application_error(-20000, '来源帐号不存在');
end if;
--检查来源帐号是否锁定
if(v_lock=1)then
Raise_application_error(-20001, '来源帐号被锁定');
end if;
--检查来源帐号的余额是否不足
if(v_balance<10)then
Raise_application_error(-20004, '来源帐号的余额不足');
end if;
--增加目的帐号的金额
update t_account set a_balance=a_balance+p_money where a_id=p_id_to
return a_lock into v_lock;
--检查目的帐号是否存在
if(sql%notfound)then
Raise_application_error(-20002, '目的帐号不存在');
p_id_to t_account.a_id%type,
p_money t_account.a_balance%type)
as
v_id_from t_account.a_id%type;
v_lock t_account.a_lock%type;
v_id_to t_account.a_id%type;
v_balance t_account.a_balance%type;
begin
--减去来源帐号的金额
update t_account set a_balance=a_balance-p_money where a_id=p_id_from
return a_balance,a_lock into v_balance,v_lock;
--检查来源帐号是否存在
if(sql%notfound)then
Raise_application_error(-20000, '来源帐号不存在');
end if;
--检查来源帐号是否锁定
if(v_lock=1)then
Raise_application_error(-20001, '来源帐号被锁定');
end if;
--检查来源帐号的余额是否不足
if(v_balance<10)then
Raise_application_error(-20004, '来源帐号的余额不足');
end if;
--增加目的帐号的金额
update t_account set a_balance=a_balance+p_money where a_id=p_id_to
return a_lock into v_lock;
--检查目的帐号是否存在
if(sql%notfound)then
Raise_application_error(-20002, '目的帐号不存在');
资源评论
- jayyuchun2012-12-18一般吧。没用上
hongbinzhao
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功