Re: date as a foreign key

From: <MSherrill_at_compuserve.com>
Date: Wed, 26 Sep 2001 16:01:42 GMT
Message-ID: <3bb1f004.7781649_at_news.compuserve.com>


On Wed, 19 Sep 2001 17:46:45 GMT, Aloha Kakuikanu <nospam_at_newsranger.com> wrote:

>Same as "real" numbers? Isn't there a way to construct 2 equal TIMESTAMP values
>(NUMBERs, etc) for which equality guaranteed to return "TRUE"?

Some dbms store dates and times as floating-point offsets from a fixed point in time. I'm pretty sure Sybase and SQL Server do that. Don't know much about Oracle.

You can create two equal floating-point values by generating the first however you like, then copying it. Strictly speaking, an arbitrary floating-point number might not be what you expect it to be, due to error of approximation. But it will still compare equal to a copy of itself.

Using identical code to generate two floating-point numbers can't be guaranteed to work over time. In other words, implementing algorithm Foo in a stored procedure to generate floating-point numbers might give you one answer today, and a different answer tomorrow. That's because something underlying the algorithm can change--FPU instructions, runtime libraries, compiler optimizations, and so on.

-- 
Mike Sherrill
Information Management Systems
Received on Wed Sep 26 2001 - 18:01:42 CEST

Original text of this message