Subject Re: [firebird-support] check if content string is integer
Author Martijn Tonies
>I need to check the content of a varchar if it is possible to cast as
> cast raises an exception, if it the varchar is not compatuble with
> integer.
> In a trigger I want to store the numeric value of a varchar field into an
> integer field, if the varchar contents anything that is possible to
> convert. If it is not possible I want the integer field to be set to 0.
> Is there a way to do so, without using an udf?

In the trigger, CAST to Integer, if this fails, use exception handling
and store 0.

With regards,

Martijn Tonies
Upscene Productions

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

Database questions? Check the forum: