Subject Re: [firebird-support] Time difference in minutes/seconds/whatever
Author PenWin
>> So I modified it with CAST to DOUBLE PRECISION:
>>
>> ...
>> min_diff = CAST(time1 AS DOUBLE PRECISION)*60*24;
>> ...
>>
>> This compiles OK, but when I try to execute the procedure:
>> SELECT * FROM diff(field1, field2)
>> I get an error message:
>> "conversion error from string "0.013194444""
>
> That is not a solution. Create a numeric(18,9) variable for the result of the timestamp difference and then you will have a type on which arithmetic can operate.

Hmm. So the conversion error occurs on line

var = time1-time2;

Rather than on the:

min_diff = var*60*24;

?

Apparently if I do add "var DOUBLE PRECISION" variable, it starts
working as expected.

Thanks,

Pepak