OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: String to number conversion

From: Lukasz Misztal (miszlukgmail.com)
Date: Tue Jun 19 2007 - 13:03:06 CDT


Dusan,
try to create own function, for basic example:

CREATE FUNCTION GETASNUMERIC (s1 VARCHAR) RETURNS NUMERIC
AS
IF UPPER(s1) = LOWER(s1)
THEN RETURN NUM(s1)
ELSE RETURN null;

It is probably only way to do this.

Best regards,

Lukasz

> Hello,
> I want to convert Varchar ASCII column to Integer data type.
> When I'm using NUM () function and my string column contains
characters >that cannot be interpreted as a numeric value
> statement returns me an error.
> Is it possible to convert chracters to numbers, while entries that >
cannot be interpreted as a numeric values will be null ??

> Thanks Dusan

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb