CREATE FUNCTION isnum(
p_string VARCHAR(32)
)
RETURNS int(4)
NOT DETERMINISTIC
SQL SECURITY DEFINER
COMMENT '检查字符串是否为纯数字'
BEGIN
/*检查字符串是否为纯数字*/
/*返回值:1-为纯数字 0-非纯数字*/
DECLARE iResult INT DEFAULT 0;
SELECT p_string REGEXP '^[0-9]*$' INTO iResult;
IF iResult = 1 THEN
RETURN 1;
ELSE
RETURN 0;
END IF;
END;
p_string VARCHAR(32)
)
RETURNS int(4)
NOT DETERMINISTIC
SQL SECURITY DEFINER
COMMENT '检查字符串是否为纯数字'
BEGIN
/*检查字符串是否为纯数字*/
/*返回值:1-为纯数字 0-非纯数字*/
DECLARE iResult INT DEFAULT 0;
SELECT p_string REGEXP '^[0-9]*$' INTO iResult;
IF iResult = 1 THEN
RETURN 1;
ELSE
RETURN 0;
END IF;
END;
select * from catery_LeafKeywords where isnum(id)<>2 AND CAST(id as DECIMAL)>2 and CAST(id as DECIMAL)<100;
select * from catery_LeafKeywords where id*1>2 and id*1<100;