java - Prepared statement not working, resultset.next() has no records -
running below java code
final string qry = queryconstants.query; connection con = null; preparedstatement stmt = null; resultset rs = null; try { con = getdatasource().getconnection(); stmt = con.preparestatement(qry); stmt.setstring(1, abc1); stmt.setlong(2, abc2); stmt.setstring(3, abc3); long st = system.currenttimemillis(); rs = stmt.executequery(); long end = system.currenttimemillis(); logger.error("retrialdaoimpl.fetchfailedmessagefromdb:: time taken fetch failed messages::" + (end - st) + "|likepattern::" + likepattern); while (rs.next()) { system.out.println(rs.getstring("version_number")); }
query below
select max(version_number) version_number, tlo_type, tlo_id msg_xml status ='n' , recoverable_flag ='y' , pattern =1 , rownum <= 100 group tlo_type, tlo_id) t1, msg_xml x x.tlo_type = t1.tlo_type , nvl(x.tlo_id,1) = nvl(t1.tlo_id,1) , x.vdps_version_number = t1.vdps_version_number , x.status ='n' , x.recoverable_flag ='y' , x.pattern = 1 order x.retry_count, x.updated_time
msg_xml view. tried running sql on sql developer returns record why result set not return anything.
Comments
Post a Comment