创建存储过程:
CREATE procedure ordertotal(in onumber int, in taxable boolean, out ototal decimal(8,2) ) COMMENT 'Obtain order total,optionally adding tax'beginDECLARE 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智能存储过程的内容,更多相关内容请关注PHP中文网(www.php.cn)!
存了个图
视频图片解析/字幕/剪辑,视频高清保存/图片源图提取
17 查看详情 
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/419294.html
微信扫一扫
支付宝扫一扫