Subject | Extract Problem |
---|---|
Author | elitalaw |
Post date | 2004-05-18T03:51:09Z |
Hi,
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
Appreciate if someone can point out my mistake and the solution to
it.
thx,
eLita
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
Appreciate if someone can point out my mistake and the solution to
it.
thx,
eLita