count does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manu

mybatis 查询用户总个数时
报错

org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: FUNCTION eesy_mybatis.count does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
### The error may exist in com/itheima/dao/IUserDao.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: SELECT count (id) FROM user
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: FUNCTION eesy_mybatis.count does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
	at com.sun.proxy.$Proxy5.findUserCount(Unknown Source)
	at com.itheima.test.mybatis.testFindUserCount(mybatis.java:131)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: FUNCTION eesy_mybatis.count does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.Util.getInstance(Util.java:381)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:995)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
	at com.sun.proxy.$Proxy7.execute(Unknown Source)
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:63)
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
	at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
	at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
	at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
	... 34 more

原因:::

SELECT COUNT (id) FROM user

在SQL语句中 COUNT (id) count与(id)之间存在空格,去掉空格!!!!
即:

<select id="findUserCount" resultType="int">
        SELECT COUNT(id) FROM user
    </select>

解决!!

### 解决 Oracle PL/SQL 函数不存在的错误 当遇到 `hbjt_ebidding_prod.COUNT` 这样的函数不存在错误时,可以按照以下方法排查和解决问题。 #### 1. 验证对象是否存在 确认目标模式下确实存在名为 `COUNT` 的函数。可以通过查询数据字典视图 `ALL_OBJECTS` 或者更具体的 `USER_PROCEDURES` 来验证: ```sql SELECT OBJECT_TYPE, STATUS FROM ALL_OBJECTS WHERE OWNER = 'HBJT_EBIDDING_PROD' AND OBJECT_NAME = 'COUNT'; ``` 如果返回为空,则说明该函数未创建或者已被删除[^1]。 #### 2. 检查权限 即使函数存在于数据库中,也需要确保当前会话具有调用此函数所需的适当权限。如果没有足够的权限访问特定的对象,也会抛出类似的异常信息。因此应该核实用户角色及其授予的权利是否允许执行这个操作[^2]。 #### 3. 编译状态检查 有时由于语法或其他原因可能导致包体未能成功编译而处于无效状态。此时应尝试重新编译有问题的过程或整个程序单元,并查看是否有任何警告或错误消息提示出来帮助定位具体位置的问题所在。 对于单个过程可使用如下命令进行强制编译: ```plsql ALTER FUNCTION HBJT_EBIDDING_PROD.COUNT COMPILE; ``` 而对于整个方案下的所有组件则可以用下面的方式批量处理: ```plsql BEGIN DBMS_UTILITY.COMPILE_SCHEMA('HBJT_EBIDDING_PROD'); END; / ``` #### 4. 调试与日志记录 利用调试工具和技术收集更多关于失败的信息可以帮助更快找到根源并加以修复。比如启用跟踪选项或将必要的输出重定向到客户端窗口以便观察内部逻辑流程走向等措施均有助于诊断复杂情况下的故障现象[^3]. #### 5. 网络配置审查 考虑到网络层面的因素也可能影响远程链接至指定实例的能力,特别是涉及到跨节点通信的情况下更是如此。所以有必要仔细审视 TNSNAMES 文件定义的服务描述符以及监听器设置等方面的内容以排除潜在障碍因素的存在可能性[^4].
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值