Let's go

mysql自定义函数

1.创建带有参的函数

create function newdate()
return varchar(20)
return date_format(curdate(),'%Y年%m月%d日')

select newdate();

--创建带有参的函数
create function show_name_store(bid int)
return varchar(50)
return  (select concat_ws('----',book_name,store) from bookinfo where book_id=bid)

select show_name_store(2015);

--删除函数
drop function newdate;
drop function if exists newdate

 

posted @ 2018-12-03 09:11  chenze  阅读(231)  评论(0编辑  收藏  举报
有事您Q我