Subject Stored procedure type checking issue
Author Robert martin
Hi

I have a stored procedure that takes a 'code' as a varChar parameter.
This parameter needs to be checked against 3 fields, code1, code2 and ref .
So I have an SQL like

Select *
from table
WHERE ref = :testCode
OR code1 = :testCode
OR code2 = :testCode


The problem is that while code1 and code2 are character fields, ref is
always numeric. Normally the testCode will be a numeric string but
sometimes it wont. When this happens the SQL breaks. We are using FB
2.1 and there is no built in is numeric test function. I had thought to
use internal exception trapping like

try
Select *
from table
WHERE ref = :testCode
OR code1 = :testCode
OR code2 = :testCode
except
Select *
from table
WHERE code1 = :testCode
OR code2 = :testCode
end;

.... Continue on


However is seems that PSQL exception handling doesn't allow this.

Show any suggestions would be appreciated !

Cheers
Rob