Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 25 total
Thread Inverval problem
Thu, Sep 3 2009 8:09 AMPermanent Link

Uli Becker
After many tries I have to ask for your help:

select * from kalender where
StartTime - interval '3' DAY > CURRENT_DATE

works fine while this:

select * from kalender where
StartTime - interval DaysBefore DAY > CURRENT_DATE

does not work.

What am I doing wrong? (DaysBefore is an integer - StartTime a DateTime
field).

Thanks. Uli
Thu, Sep 3 2009 8:41 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Uli


Trying to test in EDBManager, in a query, I get the following error message

ElevateDB Error #700 An error was found in the statement at line 1 and column 34 (Expected Interval Day, Interval Day To Hour, Interval Day To Minute, Interval Day To Second, Interval Day To MSecond, Interval Hour, Interval Hour To Minute, Interval Hour To Second, Interval Hour To MSecond, Interval Minute, Interval Minute To Second, Interval Minute To MSecond, Interval Second, Interval Second To MSecond, or Interval MSecond expression but instead found INTERVAL '?' DAY)

So I suspect that parameters just aren't allowed.

I'm guessing that you're trying to use a parameterised query not a script.

Roy Lambert [Team Elevate]
Thu, Sep 3 2009 9:54 AMPermanent Link

Uli Becker
Roy,

> I'm guessing that you're trying to use a parameterised query not a script.

I don't use any parameters. Just the simple query I posted. (DaysBefore
is an integer-field of the same table).

Uli
Thu, Sep 3 2009 10:29 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Uli


Sorry - I misunderstood. But I get exactly the same error message so it looks as though only constants are allowed presently. It does seem a strange limitation so either its a bug or its a strange limitation Smiley

Roy Lambert [Team Elevate]
Thu, Sep 3 2009 10:50 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Uli,

SELECT *
FROM Kalender
WHERE StartTime - CAST(DaysBefore AS INTERVAL DAY) > CURRENT_DATE


--
Fernando Dias
[Team Elevate]
Thu, Sep 3 2009 11:02 AMPermanent Link

Uli Becker
Fernando,

> SELECT *
> FROM Kalender
> WHERE StartTime - CAST(DaysBefore AS INTERVAL DAY) > CURRENT_DATE

Thanks. That's it.
Though I am not sure why "DaysBefore" has to casted in this way. Is
there a rule or any hint in the manual?

Uli
Thu, Sep 3 2009 11:24 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

I've suggested to Tim as part of an email conversation that INTERVALs would make a good subject for one of his technical articles.


I don't know about anyone else but they baffle the hell out of me.

Roy Lambert
Thu, Sep 3 2009 12:08 PMPermanent Link

Uli Becker
Roy,

> I've suggested to Tim as part of an email conversation that INTERVALs would make a good subject for one of his technical articles.

Excellent idea!

> I don't know about anyone else but they baffle the hell out of me.

Now there are already two of us. Smiley

Uli
Thu, Sep 3 2009 12:09 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Uli,

EDB manuals don't elaborate much around this, maybe because it's standard SQL
2003 (and SQL:1999) syntax, however Interval types are extensively referenced:

http://www.elevatesoft.com/manual?action=mantopic&id=edb2sql&category=2&topic=35

I don't knows if it deserves an article, as Roy suggested, but I agree that at
least some examples in the manual could be helpful.

--
Fernando Dias
[Team Elevate]
Thu, Sep 3 2009 12:17 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Uli,

> Though I am not sure why "DaysBefore" has to casted in this way.

Exactly for the same reason why you can't subtract Integers and CHARs, i.e.
because it's an Integer column - if it was defined as an INTERVAL DAY column it
wouldn't be necessary to do a type conversion.

--
Fernando Dias
[Team Elevate]
Page 1 of 3Next Page »
Jump to Page:  1 2 3
Image