Howto check if decimal is valid value

Database
Enthusiast

Howto check if decimal is valid value

Hi All,

How to check if the given decimal is valid. I usually do a case statement like below to check if column is invalid or NULL then set it to 0 else take it as it is:

case when decimal_column is NULL or decimal_column NOT BETWEEN -999999999999 AND 999999999999 then 0 else decimal_column end


Can anyone please let me know if the above query looks correct

Thanks

1 REPLY
Enthusiast

Re: Howto check if decimal is valid value

Try regex, if yours is 14.10 version...

SEL REGEXP_SIMILAR('111','\d\d\d','i')