Subject Re: [firebird-support] TIME datatype
Author Helen Borrie
At 05:25 PM 6/02/2009, Fidel Viegas wrote:
>On Fri, Feb 6, 2009 at 3:59 AM, Helen Borrie <helebor@...> wrote:
>
>>
>> Old InterBase versions used to convert datetime literals in a fairly
>> unreliable manner. It got cleaned up at v.6 and you need to cast time
>> literals in a lot of places where IB 5 and lower didn't require it.
>
>Now, that is strange. I have tried the following code in Firebird
>2.1.1 on Linux and I get it to run successfully.
>
>---------------------------------- begin code
>---------------------------------------------------
>CREATE or alter PROCEDURE TP returns (Endtime TIME)
>
>AS
>
>DECLARE VARIABLE Starttime TIME;
>
>begin
>
>StartTime = '08:00';
>
>EndTime = StartTime;
>suspend;
>end
>---------------------------------- end code
>-------------------------------------------
>
>Is this supposed to be a bug?

Not if it works. ;-)

>Shouldn't I have to cast the string to a time just as you described?

If you got it to work with an assignment, then apparently not.

Note, not all contexts of date literals usage require the cast. Pre-IB 6, it was allowed in any context where a Dialect 1 DATE was being passed as a constant value. Post IB 6, with Dialect 3 databases, some do, some don't. The trick is to know which contexts need the cast and which don't...and then another version comes out and the rules change again.

So, IMO, it's wise to do the cast in all contexts but particularly in a situation where not casting causes an exception.

./heLen