select custid,memberid,
	to_char(createtime,'yyyy-mm-dd hh24:mi:ss') createtime ,
	planid,auditstate,to_char(modifytime,'yyyy-mm-dd hh24:mi:ss') modifytime,createid ,
	to_char(custappdate,'yyyy-mm-dd hh24:mi:ss') custappdate,executeState,gmtcreate,custname,planbatchid 		
from( 		
	select custid,memberid,createtime,planid,auditstate,createid ,custappdate,executeState,custname,gmtcreate ,cnt,planbatchid ,modifytime 		
	from( 		
		select p.custid,p.memberid,p.createtime,p.planid,p.auditstate,p.createid ,p.custappdate,p.modifytime,p.gmtcreate,p.executeState,
			c.custname,row_number() over(order by p.memberid asc ,p.createtime DESC ) cnt,p.planbatchid 
		from x_plp_f_u_c_k p ,x_xcde c 
		where p.custid=c.custid  		
			AND p.applytype = 0   		 			  				 				
			AND p.createtime BETWEEN to_date(?,'yyyy-mm-dd') 
			AND to_date(?,'yyyy-mm-dd hh24:mi:ss') 				  				 				 			    
			AND 				 (p.auditstate = ? and p.executestate = 1) 			     			     			     			 			
			AND auditstate != 3	 		     		    
			AND 		    	p.memberid in (?) 		     		 		
		)t 
	WHERE t.cnt < ? 		)k  
WHERE k.cnt > ? 		
ORDER BY memberid ASC, createtime DESC 	

---------------------------
SELECT custid, memberid, to_char(createtime, 'yyyy-mm-dd hh24:mi:ss') AS createtime
	, planid, auditstate, to_char(modifytime, 'yyyy-mm-dd hh24:mi:ss') AS modifytime
	, createid, to_char(custappdate, 'yyyy-mm-dd hh24:mi:ss') AS custappdate, executeState
	, gmtcreate, custname, planbatchid
FROM (
	SELECT custid, memberid, createtime, planid, auditstate
		, createid, custappdate, executeState, custname, gmtcreate
		, cnt, planbatchid, modifytime
	FROM (
		SELECT p.custid, p.memberid, p.createtime, p.planid, p.auditstate
			, p.createid, p.custappdate, p.modifytime, p.gmtcreate, p.executeState
			, c.custname, row_number() OVER (ORDER BY p.memberid ASC, p.createtime DESC) AS cnt, p.planbatchid
		FROM x_plp_f_u_c_k p, x_xcde c
		WHERE p.custid = c.custid
			AND p.applytype = 0
			AND p.createtime BETWEEN to_date(?, 'yyyy-mm-dd') AND to_date(?, 'yyyy-mm-dd hh24:mi:ss')
			AND (p.auditstate = ?
				AND p.executestate = 1)
			AND auditstate != 3
			AND p.memberid IN (?)
	) t
	WHERE t.cnt < ?
) k
WHERE k.cnt > ?
ORDER BY memberid ASC, createtime DESC