Subject | Re: [firebird-support] Extract Problem |
---|---|
Author | Ivan Prenosil |
Post date | 2004-05-19T11:00:53Z |
> I have these query which work perfectly fineIn DSQL I get different error "SQL error code = -804, Data type unknown".
>
> 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
Anyway, you can evaluate the expression on the client:
> SELECT * FROM JCMBRARCLOSINGBAL JC WHERE JC.PERIOD = ?;Ivan