List:General Discussion« Previous MessageNext Message »
From:Glyn Astill Date:October 15 2009 9:43am
Subject:Re: is_string or is_numeric
View as plain text  
> From: sangprabv <sangprabv@stripped>
> Subject: is_string or is_numeric
> To: mysql@stripped
> Date: Thursday, 15 October, 2009, 10:34 AM
> Hi,
> I found no built in function in mysql to check whether a
> record is
> numeric or string. Is there any trick to do so? Many
> thanks.

You could use some regex to do it...

In fact, a google brings up this
> (http://forums.mysql.com/read.php?60,1907,241284#msg-241284)

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


Glyn


      
Thread
is_string or is_numericsangprabv15 Oct
  • Re: is_string or is_numericGlyn Astill15 Oct
    • Re: is_string or is_numericClaudio Nanni15 Oct
  • Re: is_string or is_numericwalter harms15 Oct