1、建表
create table abing(
id int not null auto_increment,
name varchar(30),
constraint pk primary key(id)
)
2.创建函数
create function fabin(parameter varchar(10))returns char(100)
BEGIN
declare result int;
declare restatus char(100);
select count(*) into result from abing where name like CONCAT('%',parameter,'%');
set restatus=CAST(result AS CHAR);
return(restatus);
end
3、测试函数语句
select fabin('abing');