当前位置: 代码迷 >> 综合 >> ORACLE语句在Java代码中执行时报错:ORA-00911: 无效字符
  详细解决方案

ORACLE语句在Java代码中执行时报错:ORA-00911: 无效字符

热度:65   发布时间:2024-01-12 05:10:28.0

 

 <!-- 根据指定的信息包递归查询所有子信息包 --><sql-query name="queryChildInfoPacks"><!-- DB2 --><!--<![CDATA[with temptab(pack_id, seq, name, eff_Date, exp_date, pack_level, parent_pack_id, sts, mean) as(select pack_id, seq, name, eff_Date, exp_date, pack_level, parent_pack_id, sts, meanfrom info_packwhere pack_id=:aaaunion allselect son.pack_id pack_id, son.seq seq, son.name name, son.eff_Date eff_date, son.exp_date exp_date, son.pack_level pack_level, son.parent_pack_id parent_pack_id, son.sts sts, son.mean meanfrom info_pack son ,temptab parentwhere son.parent_pack_id = parent.pack_id) select {a.*} from temptab a;]]>--><!-- ORACLE --><![CDATA[select {a.*} from info_pack a start with a.parent_pack_id=:aaa connect by prior a.pack_id=a.parent_pack_id]]><return alias="a" class="cn.com.samueli.cuv.pojos.InfoPack"/></sql-query>

 

问题描述:

      上面的代码是在实际应用递归查询时,配置在Hibernate的POJO配置文件中的一个查询,DB2没有问题,而ORACLE语句在Java代码中执行时报错:ORA-00911: 无效字符?

原因分析:

      原因是在针对Oracle的SQL语句末尾加上了分号的缘故,去掉就OK了。对于DB2中不存在这个问题。

  相关解决方案