java连Oracle

nick216 2007-10-26 10:49:29
String sql = "select * from (select rownum rid,newsid,title,content,createdate from news) ttt where ttt.rid<="
+ pagesize
+ "*"
+ page
+ " and ttt.rid>"
+ pagesize
+ "*("
+ page + "-1);";
System.out.println(sql);
String sql2="select * from news";

try {
Connection conn = new DBConnection().getConnection();
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery(sql);
while (rs.next()) {
。。。

当我这样执行,输入参数,就是不能执行,报如下错误:
select * from (select rownum rid,newsid,title,content,createdate from news) ttt where ttt.rid<=5*1 and ttt.rid>5*(1-1);
java.sql.SQLException: ORA-00911: 无效字符


而我在PLSQL里面确实可以执行的
哪位帮我个忙啊
...全文
137 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
weaponofpower 2007-10-26
  • 打赏
  • 举报
回复
不能要最后面的';'分号!

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧