tags:

views:

649

answers:

1

Hi,

Why doesn't this work (when parameter is set to 1):

SELECT * FROM TABLE WHERE TIMESTAMPFIELD > (CURRENT_TIMESTAMP - ?)

But this works:

SELECT * FROM TABLE WHERE TIMESTAMPFIELD > (CURRENT_TIMESTAMP - 1)

I get error message: "conversion error from string "39723.991882951" "

I'm using Firebird 2.1

EDIT:

I found the answer myself with a little help:

SELECT * FROM TABLE WHERE TIMESTAMPFIELD > (CURRENT_TIMESTAMP - CAST(? as DECIMAL(18,9))

Works if the parameter is given as float value.

A: 

Hi!

What do you want to do exactly? Maybe I can be more helpfull with more details.

SELECT * FROM TABLE WHERE TIMESTAMPFIELD > (CURRENT_TIMESTAMP - ?)

How do you set your parameter in your code? Which language do you use?

If you use Delphi, then your parameter should be passed as Float. Ie:

MyQuery.ParamByName('delta').asFloat := 0.1;

Try this and tell us if it's working

HTH

vIceBerg
It will give ""0,1" is not a valid date and time"
Harriv
Can you build your query at runtime, putting the value directly in the quesry instead of using a parameter?
vIceBerg
Of course, but that's not pretty :)
Harriv
On top of my head, I think you do not have the choice... Unfortunately, I have to leave work. I'm going to check if the'Res a way tomorrow
vIceBerg
I found the answer, you got me on the right track
Harriv