1

当我尝试使用 spring 执行存储过程时,会引发此异常:

    Caused by: org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{call TEST_PKG.DO_IT(?, ?, ?, ?, ?, ?, ?, ?, ?)}]; SQL state [72000]; error code [1461]; ORA-01461: can bind a LONG value only for insert into a LONG column
ORA-06512: at "TEST.TEST_PKG", line 53
ORA-06512: at line 1
; nested exception is java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
ORA-06512: at "TEST.TEST_PKG", line 53
ORA-06512: at line 1

    at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:124)
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:952)
    at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:985)
    at org.springframework.jdbc.object.StoredProcedure.execute(StoredProcedure.java:117)

我正在使用 myfaces 1.2.5,spring 2.0.2

第一个参数是 Integer,最后一个参数是 NUMBER。Oracle 类型和 Java 类型的映射如下:

Integer -> Numeric
NUMBER -> Decimal.

我的问题是这个异常的原因是什么以及如何解决它?

提前致谢。

4

2 回答 2

0

错误源自 TEST.TEST_PKG 的第 53 行

似乎有一个 INSERT 语句的绑定类型不正确。

于 2013-05-08T07:03:34.333 回答
0

问题出在数据库中插入的文本中的新行。我只是调用 replacaAll("\n","") ,现在一切正常。

于 2013-05-08T08:24:12.363 回答