Subject Re: [firebird-support] Computed Column Exception Handling
Author Martijn Tonies
Hi Steve,

> is there a way to handle a tables' computed column exceptions
> (within the database) in V1.5 that I've forgotten about?
>
> I want to allow my users to enter a quantity like '10.5 lengths' into
> a varchar field, and extract the numeric quantity into another field
> for use in calculations.
>
> eg.
> alter table ORDER_ITEMS add QTY computed by
> (coalesce(cast(F_FINDWORD(QTY_TEXT, 0) as float),0))^
>
> This usually works OK, unless they stupidly enter a non-numeric first,
> or forget the space between the number and the words. This will give
> me an ISC ERROR CODE:335544334 ISC ERROR MESSAGE:conversion error
> from string "dogs"
>
> Just wondering if I can make it return 0 for that column, without
> resorting to client-side handling.

No offence, but you created this can of worms yourself.

I don't know what the "QTY" field means, but what if the user
enters "12 dozen", cause they can?

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com