Woocommerce MySQL Function to test if value is a number

We have product costs entered into custom Woocommerce fields. But to use the values in queries, we need to ensure only numbers have been entered:

This function looks good:


create function isnumeric(val varchar(1024)) 
returns tinyint(1) deterministic 
return val regexp '^(-|\\+)?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+|[0-9]+)$';