convert TSQL query to MySQL -
i need convert tsql query mysql query version 5.7.14 tried declare parameter following syntax
declare @commissiontype int;
but reached dead end , need convert query
create procedure myproc @chainid int begin declare @commissionmethod int declare @commissiontype int declare @value decimal(18,2) set @commissionmethod = 1 set @value = 200000 set @commissiontype = (select commissiontype commissionrules chainid = @chainid ) if(@commissionmethod = 1) begin print('alert') select (fixed * @value) / 100 commissionrules chainid = @chainid end end
this pretty literal conversion. check logic. doesn't make sense. v_commissionmethod
1 , v_commissiontype
not being used after selecting value.
delimiter // create procedure myproc ( p_chainid int) begin declare v_commissionmethod int; declare v_commissiontype int; declare v_value decimal(18,2); set v_commissionmethod = 1; set v_value = 200000; select commissiontype v_commissiontype commissionrules chainid = p_chainid ; if(v_commissionmethod = 1) /* print('alert') */ select (fixed * v_value) / 100 commissionrules chainid = p_chainid; end if; end; // delimiter ;
Comments
Post a Comment