CREATE FUNCTION mysql server version 4.1.7-log

jbose2ul  于 2023-03-22  发布在  Mysql
关注(0)|答案(1)|浏览(92)

服务器:

C:\Appserv\mysql\bin\mysql.exe  Ver 14.7 Distrib 4.1.7, for Win95/Win98 (i32)
    
    Connection id:          296 
    Current database: 
    Current user:           ODBC@localhost 
    SSL:                    Not in use 
    Using delimiter:     ; 
    Server version:         4.1.7-log 
    Protocol version:       10 
    Connection:             localhost via TCP/IP 
    Server characterset:    latin1 
    Db     characterset:    latin1 
    Client characterset:    latin1 
    Conn.  characterset:    latin1 
    TCP port:               3306

查询功能:

CREATE FUNCTION IF NOT EXISTS isNumeric (input VARCHAR(255))
    RETURNS INT  DETERMINISTIC  RETURN input REGEXP '^[0-9]+\\\\.?[0-9]*$';

错误日志:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS isNumeric (input VARCHAR(255))
rdrgkggo

rdrgkggo1#

正如mysql manual on create function所说(重点是我的):
IF NOT EXISTS可以防止已经存在同名例程时出现错误。MySQL 8.0.29开头的CREATE FUNCTION和CREATE PROCEDURE都支持该选项。
你的mysql server版本必须比v8.0.29旧,这就是为什么你得到语法错误。

相关问题