Subject Re: [firebird-support] Extract Problem
Author Ivan Prenosil
> I have these query which work perfectly fine
>
> SELECT * FROM JCMBRARCLOSINGBAL JC WHERE
> JC.PERIOD = EXTRACT(YEAR FROM CAST('2004-04-18' AS DATE))* 100 +
> EXTRACT(MONTH FROM CAST('2004-04-18' AS DATE)) - 1
>
> but when i try to pass a parameterized query
>
> SELECT * FROM JCMBRARCLOSINGBAL JC WHERE
> JC.PERIOD = EXTRACT(YEAR FROM CAST(? AS DATE))* 100 +
> EXTRACT(MONTH FROM CAST(? AS DATE)) - 1
>
> i got an error
> The parameters passed are class java.sql.Date
>
> SQL error code = -105
> Specified EXTRACT part does not exist in input datatype

In DSQL I get different error "SQL error code = -804, Data type unknown".
Anyway, you can evaluate the expression on the client:
> SELECT * FROM JCMBRARCLOSINGBAL JC WHERE JC.PERIOD = ?;

Ivan