TTITLE RIGHT:右头行
'Page:':显示的字符
FORMAT 999:格式化
SQL.PNO:显示页码函数
结果:----------------------------------------------------------Page:1
String str2=""for(int pno=0pno<3pno++){
if(pno==0){
str2="select * from (select rownum rowa,d.* from (select ssw.sms_id,ssw.phone_number from sms_send_wait ssw left join sms_send_receive ssr on ssr.sms_id = ssw.sms_id where not exists ( select ssrb.phone_number from sms_send_receive_blacklist ssrb where ssrb.phone_number=ssw.phone_number) and ssw.send_wait_time between sysdate-1 and sysdate+1) d where rownum<=pno*2) where rowa>(pno-1)*2"
}else{
str2=str2+" union "+ "select * from (select rownum rowa,d.* from (select ssw.sms_id,ssw.phone_number from sms_send_wait ssw left join sms_send_receive ssr on ssr.sms_id = ssw.sms_id where not exists ( select ssrb.phone_number from sms_send_receive_blacklist ssrb where ssrb.phone_number=ssw.phone_number) and ssw.send_wait_time between sysdate-1 and sysdate+1) d where rownum<=pno*2) where rowa>(pno-1)*2"
}
}
pstmt = conn.prepareStatement(str2)
ResultSet rs = pstmt.executeQuery()
// 你要是想把sql语句拼起来,一次性执行了,就用上面的方法,要是不想或不会拼,可以把pstmt = conn.prepareStatement(str2)
ResultSet rs = pstmt.executeQuery()
写到for循环里面,每循环一次执行一次,都可以的!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)