当前位置:Gxlcms > 数据库问题 > MySQL函数

MySQL函数

时间:2021-07-01 10:21:17 帮助过:3人阅读

实例1

mysql> create function LocateWords
    -> (s CHAR(20),t CHAR(20))
    -> RETURNS int(11)
    -> return locate(t,s);
mysql> select LocateWords(‘abcdabcaba‘,‘da‘);


实例2

mysql> CREATE FUNCTION Fun_GetQuesCntByClass
    -> (
    -> c bigint
    -> )
    -> returns int
    -> begin
    -> declare x int;
    -> select count(1) into x from Ques where classid=c;
    -> return (x);
    -> end;
mysql> select Fun_GetQuesCntByClass(1);


注意:

MySQL没有像MSSQL的表值函数(用存储过程实现)


本文出自 “sukun” 博客,请务必保留此出处http://sukunwu.blog.51cto.com/10453116/1688341

MySQL函数

标签:mysql   函数   

人气教程排行