Subject | Re: [firebird-support] Can't insert transaction. |
---|---|
Author | Helen Borrie |
Post date | 2008-08-07T23:01:01Z |
At 07:31 AM 8/08/2008, you wrote:
I think people sometimes confuse context variables with date literals. They are different organisms. Date literals must be single-quoted, context variables must not.
At 07:31 AM 8/08/2008, Dee Holtsclaw wrote:
You never have to cast context variables to their native data type. You can, of course, cast them to other types. For example:
...
declare variable MyTimestampString varchar(24);
...
begin
MyTimestampString = cast(current_timestamp as varchar(24))
...
..
end
And this cast expression is valid, too:
cast(current_timestamp as date)
./heLen
>On Thursday 07 August 2008 5:22:51 pm Alan McDonald wrote:NOT !
><SNIP>
>> > > Error Message:
>> > > ----------------------------------------
>> > > Overflow occurred during data type conversion.
>> > > conversion error from string "CURRENT_TIMESTAMP".
>>
>> use single quotes
>> Alan
I think people sometimes confuse context variables with date literals. They are different organisms. Date literals must be single-quoted, context variables must not.
At 07:31 AM 8/08/2008, Dee Holtsclaw wrote:
>My initial guess is that CURRENT_TIMESTAMP is being interpreted as a stringQuoting CURRENT_TIMESTAMP would cause that.
>when it should not be.
>Maybe a CAST('CURRENT_TIMESTAMP' AS TIMESTAMP) is inThat would certainly *cause* this problem. ;-) If you put quotes around a context variable, it's not a context variable any more, just a string consisting of the characters 'C|U|R|R|E|N|T|_|T|I|M|E|S|T|A|M|P'. There is nothing in that string that could convert to a timestamp type - hence the exception.
>order ...
You never have to cast context variables to their native data type. You can, of course, cast them to other types. For example:
...
declare variable MyTimestampString varchar(24);
...
begin
MyTimestampString = cast(current_timestamp as varchar(24))
...
..
end
And this cast expression is valid, too:
cast(current_timestamp as date)
./heLen