Mysql存储过程订单生成

订单号生成记录表:

drop table if exists other_order_record_sequence;
create table other_order_record_sequence(
	id bigint(20) primary key auto_increment,
	order_record_sequence_type varchar(5) not null comment '订单类型',
	seq_date date not null comment '日期',
	sequence_count int(11)  not null comment '订单数',
	belonged_company bigint(20) not null comment '公司id'
)engine = innodb default charset = utf8mb4 comment '单号记录表';

订单生成存储过程:

drop procedure if exists get_order_number;
DELIMITER ;;
-- order_type_ordinal订单类型标注,order_type_code订单类型在单号中的标识,company_id公司id
create procedure get_order_number(IN order_type_ordinal varchar(5),IN order_type_code varchar(5),IN company_id bigint(20));
begin
	DECLARE exist_sequence int default 1;
    DECLARE sequence_number int(11);
    DECLARE t_error INTEGER DEFAULT 0;  
    DECLARE cur_sequence CURSOR FOR select sequence_count + 1 from other_or
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值