Subject Re: [ib-support] (unknown)
Author Helen Borrie
At 01:55 PM 23-11-01 +0000, you wrote:
>Hi All.
>I have a problem.
>I have a field declared numeric( 9,4 ) " WORKING_HOURS" in which I
>set the amount of hours necessary to build a single 0,20
>minutes or 1,20 hours.
>Now I have a field Quantity declared NUMERIC( 9,4 ) in which I put
>the items of the product to be build.
>Multiply WORKING_HOURS * QUANTITY show me some incredible wrong
>cast(WORKING_HOURS as time ) * QUANTITY <--- don't work.

The TIME type is not duration, it is "time of day" (i.e. Hours:minutes:seconds since midnight of a date) and it is calculated from the decimal portion of a DOUBLE. Even if the cast
works, it won't give you the result you want.

>What is the line of code that works?

If you are just trying to calculate the number of hours it will take to make n items, shouldn't you just multiply WORKING_HOURS * QUANTITY? You will get an (18,8) result which you will have to deal with in some way, e.g.

or whatever you need to avoid overflow.


All for Open and Open for All
InterBase Developer Initiative ยท