Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread CAST error 2
Thu, Apr 12 2007 2:33 PMPermanent Link

"Ole Willy Tuv"
select
 cast(current_timestamp as date),
 cast(current_timestamp as time)
from dummy

Error:
ElevateDB Error #700 An error was found in the statement at line 3 and
column 26
(Expected Char, VarChar, Byte, VarByte or Time expression but instead found
CURRENT_TIMESTAMP())

This seems like a bug. A TIMESTAMP value can be converted to any datetime
type.

Ole Willy Tuv

Thu, Apr 12 2007 4:11 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ole,

<< This seems like a bug. A TIMESTAMP value can be converted to any datetime
type. >>

The reason it was done was to prevent truncation of the date portion, but I
see no harm in allowing it if someone wants to do it.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Apr 12 2007 4:28 PMPermanent Link

"Ole Willy Tuv"
Tim,

<< The reason it was done was to prevent truncation of the date portion, but
I see no harm in allowing it if someone wants to do it. >>

I don't unerstand what you mean ? There's no truncation going on here. The
result is exactly the TIME part of the TIMESTAMP value. Since the the result
of the CAST is a TIME, there are no fields lost in the result.

Ole Willy Tuv

Sat, Apr 14 2007 3:08 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ole,

<< I don't unerstand what you mean ? There's no truncation going on here.
The result is exactly the TIME part of the TIMESTAMP value. Since the the
result of the CAST is a TIME, there are no fields lost in the result. >>

Well, yes, once something is cast from a timestamp to a time, then the date
is lost and can't be derived from the time value.  If you think about it in
terms of converting a column from one type to another, then you will see
what I was thinking.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image