我正在尝试按照本页中给出的语法为 hsqldb 中的聚合函数创建一个 java 语言例程 - http://hsqldb.org/doc/2.0/guide/sqlroutines-chapt.html#src_jrt_aggregate_functions
SQL used:
CREATE AGGREGATE FUNCTION TESTFUNCTION(INOUT ARG DOUBLE) RETURNS DOUBLE
NO SQL
LANGUAGE JAVA
EXTERNAL NAME 'CLASSPATH:com.XXX.tips.TestUtil.HsqlCustomFunctions.TESTFUNCTION';
我正在使用 spring jdbcTemplate.execute 方法来运行 sql,我得到了以下异常:
org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [
nested exception is java.sql.SQLException: Unexpected token: AGGREGATE in statement [
CREATE AGGREGATE]
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:98)
at
...
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.sql.SQLException: Unexpected token: AGGREGATE in statement [
CREATE AGGREGATE]
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.execute(Unknown Source)
at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:420)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:395)
... 21 more
有谁可以帮我离开这里吗?我不明白为什么会这样。这很奇怪,因为它说 AGGREGATE 是一个意外的标记,但我遵循正确的语法
提前致谢