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

You can use SUBSTRING to test the first two characters and
convert the rest to NUMERIC/INTEGER, catch the exception
and handle it.

With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com

Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!

Database questions? Check the forum:
http://www.databasedevelopmentforum.com

> 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.
>
> Examples:
>
> LF200 is right
> LF 9999 is right
> 87987 is right
> XY888 is not valid
>
> If first two characters LF -
> Statements
> Else if a numeric value
> Statemens
> Else
> Bad value
>
> Thanks in advance.
>
> With best regards
>
> Olaf Kluge
>
>
>
>
> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links
>
>
>