java.sql Timestamp and dateTime

M

moongeegee

I use Oracle 10.0.2.0.1
I need to retrieve a data ( ex: 2010-01-05 11:10:50.110) from a table
the column is mydate, the datatype is Date. I use the data insert into
another table; the datatype is date also.


sqlstmt.setTimestamp(1,res.getTimestamp("mydate");
I got an error as ORA-01847: day of month must be between 1 and last
day of month.

Please help.
 
L

Lothar Kimmeringer

moongeegee said:
sqlstmt.setTimestamp(1,res.getTimestamp("mydate");
I got an error as ORA-01847: day of month must be between 1 and last
day of month.

Please help.

What is the value of res.getTimestamp("mydate")?


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 
L

Lew

This line will not compile due to a missing parenthesis.

This is a far distance from an SSCCE.
<http://sscce.org/>
The problems most likely, rather, nearly certainly lie in the code you
have not shown us.

Lothar said:
What is the value of res.getTimestamp("mydate")?

That is the crucial question.

Other important questions:

What is the query string for 'sqlstmt'? (Side note: Follow the naming
conventions.)
What is the query string for which 'res' is (presumably) the
'ResultSet'?
Was that 'ResultSet' generated from the same 'Statement' instance
pointed to by 'sqlstmt'?

java.sql.Timestamp is not the Java type that corresponds to "DATE",
although I don't think that mistake would raise the error that you
see. Just for grins, what happens if you use the correct type
(java.sql.Date)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,202
Latest member
MikoOslo

Latest Threads

Top