Subject AW: [firebird-support] Re: Easy way to find out, if there is a numeric value in a string
Author Olaf Kluge
Hi again,

the number of characters (not digits) can be different.

Is there a simple function how I can test the varchar if there is only a
integer in it?

Thank you.






Hi,

if I do the follow:

i_mid = cast (lid as integer);

(i_mid = integer, lid = varchar) then I request a conversation error (in the
string not only digits)

I don't use the firebird 2.5, only 1.5 in this case.

Thank you for more ideas.

Olaf
________________________________________
Von: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] Im Auftrag von Myles Wakeham
Gesendet: Montag, 25. Mai 2009 16:21
An: firebird-support@yahoogroups.com; olaf.kluge@...
Betreff: [firebird-support] Re: Easy way to find out, if there is a numeric
value in a string

Olaf wrote:

> I have a stored procedure with an input parameter (varchar). A valid
> value
> can be 'LF200'. I check the first two characters of the string. 'LF' is
> valid. All other input values must be numerically. Is there a
> function, how
> I can see, if there only a numeric value in the string? The other
> way with
> 'LF' have I realised. If there other characters than 'LF' and not a
> valid
> numeric value, then the input parameter is not valid.

Can you cast the substring part of the input parameter into a numeric
variable and see if what you get from the cast, when cast back to a
string matches the substring part of the input parameter? If it
matches, its numeric. If not, it isn't.

Myles

--
=======================
Myles Wakeham
Director of Engineering
Tech Solutions USA, Inc.
Scottsdale, Arizona USA
http://www.techsolusa.com
Phone +1-480-451-7440