Oracle Rownum

agnusdei·2023년 7월 5일
0
post-custom-banner
<select id="List" parameterType="VO" resultType="VO">
    /* VO.List.selectList */
    <![CDATA[
    SELECT 
        * 
    FROM(
        SELECT ROWNUM AS RNUM , PA.*, COUNT(*) OVER() AS totRow FROM (		
            SELECT
                  WEEKLYWORK_HIST_ID seq 
                , TTL ttl
                , TO_CHAR(WEEK_ST_DATE, 'YYYY.MM.DD') weekStDate
                , TO_CHAR(WEEK_END_DATE, 'YYYY.MM.DD') weekEndDate
                , ATCH_FILE_ID atchFileId
                , (SELECT FILE_EXTSN FROM T_ATCH_FILE_DETAIL B WHERE B.ATCH_FILE_ID = A.ATCH_FILE_ID AND FILE_SN = 0 AND DEL_YN = 'N') fileExtsn
                , TO_CHAR(REG_DATE, 'YYYY.MM.DD') regDate
            FROM T_WEEKLYWORK A
            WHERE USE_YN = 'Y'
            ORDER BY WEEKLYWORK_HIST_ID DESC 	
        ) PA		  
    )
    WHERE ROWNUM <= #{firstIndex} + #{recordCountPerPage}
      AND RNUM > #{firstIndex}
    ]]>
</select>
post-custom-banner

0개의 댓글