java.sql.SQLException: ORA-01830: date format picture ends before converting ent

java.sql.SQLException: ORA-01830: date format picture ends before converting ent
ire input string

        at oracle.jdbc.driver.DatabaseError.throwSqlException(Ljava.lang.String;
Ljava.lang.String;I)V(DatabaseError.java:125)
        at oracle.jdbc.driver.T4CTTIoer.processError(Z)V(T4CTTIoer.java:305)
        at oracle.jdbc.driver.T4CTTIoer.processError()V(T4CTTIoer.java:272)
        at oracle.jdbc.driver.T4C8Oall.receive()V(T4C8Oall.java:623)
        at oracle.jdbc.driver.T4CPreparedStatement.doOall8(ZZZZ)V(T4CPreparedSta
tement.java:181)
        at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(Z)V(T4CPrepa
redStatement.java:543)
        at oracle.jdbc.driver.OracleStatement.execute_maybe_describe()V(OracleSt
atement.java:913)
        at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe()V(T4C
PreparedStatement.java:452)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout()V(OracleStat
ement.java:984)
        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal()I(OracleP
reparedStatement.java:2885)
        at oracle.jdbc.driver.OraclePreparedStatement.executeQuery()Ljava.sql.Re
sultSet;(OraclePreparedStatement.java:2926)
        at weblogic.jdbc.wrapper.PreparedStatement.executeQuery()Ljava.sql.Resul
tSet;(PreparedStatement.java:124)
        at com.wss.user.session.UserManagerEJB.updateBuyerUserInfo(Lcom.wss.user
.general.UserDTListInfo;)Ljava.lang.String;(Unknown Source)
        at com.wss.user.session.UserManagerEJB_kyi0c6_EOImpl.updateBuyerUserInfo
(Lcom.wss.user.general.UserDTListInfo;)Ljava.lang.String;(UserManagerEJB_kyi0c6_
EOImpl.java:46)

...

原因:数据表的日期格式问题,如2007-07-05 10:29:53.0 多了一个".0"解决的办法是先在查询的时候用to_char()然后在用to_date()转换.

 

你可能感兴趣的:(SQLException)