orcle异常: 无效字符
orcle错误: 无效字符
以下是sql语句,在plsql中执行是可以的。放到程序中执行就报错····
select a.au,a.acount,b.bcount,c.ccount from (select name as au,count(aid) as acount from person_info
group by name) a left join
(select name as bu,count(bid) bcount from person_info where to_char(date_created,'yyyy-mm')=to_char(sysdate,'yyyy-mm')
group by name)b on a.au=b.bu left join
(select name as cu,count(cid) ccount from Person_Info where trunc(date_created)=trunc(sysdate)
group by name) c on a.au=c.cu;
报错:
org.hibernate.exception.SQLGrammarException: could not execute query···
····
Caused by: java.sql.SQLException: ORA-00911: 无效字符
------解决方案--------------------
你用的hibernate工具!!!
是用哪个Query方法?
如果你是用createQuery:hql查询
那么最好换成createSQLQuery:原生态sql查询
------解决方案--------------------
这样嘛~~~你调试一下、把要执行的sql语句的值复制一下、然后拿去plsql里面执行!!!
无效字符、应该是格式有问题!
------解决方案--------------------
与数据库连接也有一定的关系,不同连接解释SQL语句的引擎不相同
以下是sql语句,在plsql中执行是可以的。放到程序中执行就报错····
select a.au,a.acount,b.bcount,c.ccount from (select name as au,count(aid) as acount from person_info
group by name) a left join
(select name as bu,count(bid) bcount from person_info where to_char(date_created,'yyyy-mm')=to_char(sysdate,'yyyy-mm')
group by name)b on a.au=b.bu left join
(select name as cu,count(cid) ccount from Person_Info where trunc(date_created)=trunc(sysdate)
group by name) c on a.au=c.cu;
报错:
org.hibernate.exception.SQLGrammarException: could not execute query···
····
Caused by: java.sql.SQLException: ORA-00911: 无效字符
------解决方案--------------------
你用的hibernate工具!!!
是用哪个Query方法?
如果你是用createQuery:hql查询
那么最好换成createSQLQuery:原生态sql查询
------解决方案--------------------
这样嘛~~~你调试一下、把要执行的sql语句的值复制一下、然后拿去plsql里面执行!!!
无效字符、应该是格式有问题!
------解决方案--------------------
与数据库连接也有一定的关系,不同连接解释SQL语句的引擎不相同