-- truncate table dbr_pos_closing; drop procedure if exists clo_branch_closing; DELIMITER // create procedure clo_branch_closing( _curr_date varchar(8), _branch int, _user int) BEGIN Declare _sales_day decimal(20,4) default "0.0000"; Declare _ccard_day decimal(20,4) default "0.0000"; Declare _cash_day decimal(20,4) default "0.0000"; Declare _coupon_day decimal(20,4) default "0.0000"; Declare _reward_day decimal(20,4) default "0.0000"; Declare _discount_day decimal(20,4) default "0.0000"; Declare _sorder_cnt int; Declare _sorder_new int; Declare _revisit_cnt int; Declare _log_token varchar(21); Declare _seq_no int; set _seq_no = 0; set _log_token = SUBSTR(MD5(RAND()), 1, 21); call clo_pos_closing(_curr_date, _branch, _user); -- _seq_no = _seq_no + 1;s insert into log_procedure_run ( log_token, token_seq_no, calling_procedure, procedure_name) values ( _log_token, _seq_no, 'clo_branch_closing', 'clo_pos_closing'); END; // DELIMITER ; call clo_branch_closing('20220815', 1, 5);