mysql if使用实例
时间:2021-07-01 10:21:17
帮助过:13人阅读
DELIMITER
DROP PROCEDURE
if EXISTS createAmountCount;
create PROCEDURE createAmountCount()
BEGIN
DECLARE ss VARCHAR(20);
DECLARE sqt VARCHAR(200);
set ss=
‘test‘;
set sqt=
‘select * from test WHERE 1=1 AND NAME<>‘‘‘‘ {0} ‘;
select if(ss
is null,sqt,CONCAT(sqt,
‘and date>= ‘));
END;
//DELIMITER
CALL createAmountCount();
mysql if使用实例
标签:cat drop creat declare sel code logs limit color