您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

mysql智能存储过程

2024/4/22 0:22:36发布73次查看
创建存储过程:
create procedure ordertotal( in onumber int, in taxable boolean, out ototal decimal(8,2) ) comment 'obtain order total,optionally adding tax' begin declare total decimal(8,2); declare taxrate int default 6; select sum(item_price * quantity) from orderitems where order_num = onumber into total; if taxable then select total+(total/100*taxrate) into total; end if; select total into ototal;
end;
调用存储过程:taxable为真
call ordertotal(20005,1,@total);
select @total;
调用存储过程:taxable为假
call ordertotal(20005,1,@total);
select @total;
以上就是mysql智能存储过程的内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product