Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top