Does anyone if there a function in Informix 4gl (version 4) which will let
you check the contents of a CHAR variable to see whether or not it is a
valid number, without causing a numeric conversion error?
I have an application which is requesting input from the user, and the input
can be a number, or a string. This then gets put through a CASE statement,
more or less as follows:
DEFINE
var CHAR(5)
PROMPT "Enter data: " FOR var
CASE
WHEN var>=1 AND var<=9999
DISPLAY "Var is a number"
WHEN var IS NOT NULL
DISPLAY "Var is a string"
END CASE
The problem I've got is that if the user enters a string, the program bombs
out with a "Character to numeric conversion error" at the first WHEN clause.
Lastly, does anyone know if there is a "catchall" WHEN statement (like the *
in a UNIX shell CASE statement).
Thanks for any suggestions!
Regards, Ben