Subject | Date arithmetics |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2003-04-01T10:29:24Z |
Hi everybody!
I'm just trying to select a date that is a certain period before another
date. Previously I've done this by using constants, e.g.
SELECT AColumn
FROM ATable
WHERE Date1 BETWEEN Date2 - 1096 AND Date2 - 730
Now, I want to do this using parameters, but preparing
SELECT AColumn
FROM ATable
WHERE Date1 BETWEEN Date2 - :OneInteger AND Date2 - :AnotherInteger
tells me that OneInteger has to be a TimeStamp, whereas AnotherInteger is a
Numeric(18,9).
For testing, I changed to
SELECT AColumn
FROM ATable
WHERE Date1 >= Date2 - :OneInteger
AND Date1 <= Date2 - :AnotherInteger
but that just resulted in both parameters being TimeStamps.
I thought that Fb maybe doesn't handle parameters differing from the
column, but Aage was pretty confident that it should and thought it might
possibly be some flaw in IBO in the handling of parameters. Myself, I
haven't got a clue whether this belongs here or in ib-support.
I'm using Firebird 1.0.2 Build 821 (If I'm reading things correctly), the
database is Dialect 3 and I have tested this using IB_SQL compiled with IBO
4.0.2C.
Set
I'm just trying to select a date that is a certain period before another
date. Previously I've done this by using constants, e.g.
SELECT AColumn
FROM ATable
WHERE Date1 BETWEEN Date2 - 1096 AND Date2 - 730
Now, I want to do this using parameters, but preparing
SELECT AColumn
FROM ATable
WHERE Date1 BETWEEN Date2 - :OneInteger AND Date2 - :AnotherInteger
tells me that OneInteger has to be a TimeStamp, whereas AnotherInteger is a
Numeric(18,9).
For testing, I changed to
SELECT AColumn
FROM ATable
WHERE Date1 >= Date2 - :OneInteger
AND Date1 <= Date2 - :AnotherInteger
but that just resulted in both parameters being TimeStamps.
I thought that Fb maybe doesn't handle parameters differing from the
column, but Aage was pretty confident that it should and thought it might
possibly be some flaw in IBO in the handling of parameters. Myself, I
haven't got a clue whether this belongs here or in ib-support.
I'm using Firebird 1.0.2 Build 821 (If I'm reading things correctly), the
database is Dialect 3 and I have tested this using IB_SQL compiled with IBO
4.0.2C.
Set