Hi everyone,

I'm having a problem running the following query using a PreparedStatement.

"WITH T(DIA) AS ( SELECT TO_DATE( *?1* , 'MM/DD/YYYY') 
FROM DUAL     
UNION ALL     SELECT CAST(DIA AS DATE)+1 FROM T WHERE 
DIA<TO_DATE('1/10/2016', 'MM/DD/YYYY') 
)
SELECT DIA   FROM T ORDER BY DIA desc"

I set a parameter in this way: preparedStatement.setString(1, "1/7/2016").
Then, when I execute it, the query returned me a ResultSet with a single 
row *null*.

On the other hand, when I execute this query without parameters like this:
"WITH T(DIA) AS ( SELECT TO_DATE( *'1/7/2016' *, 'MM/DD/YYYY') 
FROM DUAL     
UNION ALL     SELECT CAST(DIA AS DATE)+1 FROM T WHERE 
DIA<TO_DATE('1/10/2016', 'MM/DD/YYYY') 
)
SELECT DIA   FROM T ORDER BY DIA desc"

the ResultSet is returned correctly with four rows.

I believe it's a problem when h2 process parameters in the clause WITH.

Does anyone have any help to get a workaround for this problem ?

Thanks in advance,

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to