MySQL Forums
Forum List  »  Microsoft SQL Server

Re: IsNumeric() clause in MySQL??
Posted by: Cai Black
Date: January 07, 2009 11:34AM

Oops! Henri's does work fine. My enhancements then are the following:

* removing the space between the function name and the parentheses
* adding the size to the datatype: TINYINT(1)
* indicating that the function is deterministic: DETERMINISTIC
* replacing the range '{0,1}' with a '?'


CREATE FUNCTION ISNUMERIC(myVal VARCHAR(1024))
RETURNS TINYINT(1) DETERMINISTIC
RETURN myVal REGEXP '^(-|\\+)?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+|[0-9]+)$';


Sorry for any confusion that my previous post may have caused.
---
Cai Black



Edited 1 time(s). Last edit at 01/07/2009 11:42AM by Cai Black.

Options: ReplyQuote


Subject
Written By
Posted
September 10, 2004 12:08PM
September 16, 2004 10:31PM
November 24, 2008 04:43PM
Re: IsNumeric() clause in MySQL??
January 07, 2009 11:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.