String sql =" select * from ( select rownum r,t.*,ty.TYPE_NAME,s.NAME,p.POLICE_NAME from t_assets t left join t_assets_type ty on t.assets_type_id=ty.assets_type_id " +
" left join t_assets_sep s on t.t_assets_sep_id=s.t_assets_sep_id " +
" left join t_police p on t.police_id=p.police_id " +
" where t.deparet_code=? and t.asset_tag not like '%001003101%' " +
" and t.is_gear='1' )asset where rownum<=? and r>? ";
PreparedStatement statement=connection.prepareStatement(sql);
statement.setString(1,deptCode);
statement.setInt(2,startIndex + paginationSupport.getPageSize());
statement.setInt(3,startIndex);
ResultSet rs = statement.executeQuery(sql);
这样写报上面那错误,当我把"?"号替换成值时能执行成功。
什么原因?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货