Mybatis 查询Cause: java.sql.SQLSyntaxErrorException: ORA-00903: 表名无效
起因想通过通用方法加载不同表名查询数据,使用Mybatis查询报错
@Select(" select #{column} as str from #{table} group by #{column} order by count(1) desc ")
将 #{table} 修改为 ${table} 查询数据
@Select(" select #{column} as str from ${table} group by #{column} order by count(1) desc")
执行查询返回结果只有列名,但没有数据![在这里插入图片描述](https://img-blog.csdnimg.cn/20210202181640220.png)
需要将查询修改为
@Select(" select ${column} as str from ${table} group by ${column} order by count(1) desc")