Two SQL errors (invalid column types: getTimestamp not implemented and ORA-00984: columns are not allowed here)

Keywords: Programming Java JDBC SQL Oracle

uncategorized SQLException; SQL state [99999]; error code [17004]; invalid column type

Error phenomenon

Invalid column type: getTimestamp not implemented for class oracle.jdbc.driver.T4CNumberAccessor
; uncategorized SQLException; SQL state [99999]; error code [17004]; Invalid column type: getTimestamp not implemented for class oracle.jdbc.driver.T4CNumberAccessor; nested exception is java.sql.SQLException: Invalid column type: getTimestamp not implemented for class oracle.jdbc.driver.T4CNumberAccessor
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
	at com.sun.proxy.$Proxy140.selectList(Unknown Source)
	at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)
	at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForMany(MybatisMapperMethod.java:168)
	at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:82)
	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:61)
	at com.sun.proxy.$Proxy223.getPayLogToday(Unknown Source)
	at com.bjbde.admin.system.service.impl.OsmPayLogServiceImpl.getPayLogToday(OsmPayLogServiceImpl.java:28)
	at com.bjbde.admin.system.service.impl.OsmPayLogServiceImpl$$FastClassBySpringCGLIB$$4df311c5.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)

Conclusion:

Error reason: after troubleshooting, it is found that the date type of entity class creation is Number type in the database, which is the cause.

java.sql.SQLSyntaxErrorException: ORA-00984: columns are not allowed here

Error phenomenon

### SQL: insert into OSM_REFUND_CHECK(SID, ACCOUNT_DATE, TRADE_MONEY, TRADE_FEE, CHECK_TIME, REMARK, IS_DEL)         values (         ?,         sysdate-1,         ?,         ?,         syadate,         ?,         ?         )
### Cause: java.sql.sqlsyntax errorexception: ora-00984: column is not allowed here

; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00984: Column not allowed here

	at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:93)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.

Conclusion:

The reason for this is because when you insert a character or string type field. If the inserted data is a pure number, there will be no error; if there are characters, it will report that the ORA-00984 column is not allowed to be abnormal here.

In this case, Sysdate is mistakenly written as Syadate.

Posted by geo3d on Mon, 06 Apr 2020 07:05:29 -0700