2012-06-11 46 views
1

我必須更改Ibatis中的sql映射我想將每個tipe「list」的結果集限制爲1000行。Ibatis和Oracle極限結果集

我嘗試這樣做:

<select id="list" parameterClass="common.dto.Dto" resultClass="common.Entity"> 
     SELECT * 
     FROM table SOC 
     LEFT OUTER JOIN SOCIETASEP SEP 
     ON SEP.COSOCIETA = SOC.CODSOCIETA 

     <dynamic prepend="WHERE"> 

     ROWNUM&lt;=1000 

    <isNotEmpty prepend="AND" property="ragSoc"> 
     DSRAGSOC LIKE UPPER(#ragSoc#) || '%' 
    </isNotEmpty> 
     </dynamic> 
</select> 

但不起作用。何插入靜態條件?

感謝

回答

3

嘗試更換:

ROWNUM&lt;=1000 

由:

<![CDATA[ ROWNUM <= 1000 ]]> 

東西喜歡這樣的:

<select id="list" parameterClass="common.dto.Dto" resultClass="common.Entity"> 
     SELECT * 
     FROM table SOC 
     LEFT OUTER JOIN SOCIETASEP SEP 
     ON SEP.COSOCIETA = SOC.CODSOCIETA 
     where  
<![CDATA[ ROWNUM <= 1000 ]]> 

    <isNotEmpty prepend="AND" property="ragSoc"> 
     DSRAGSOC LIKE UPPER(#ragSoc#) || '%' 
    </isNotEmpty> 

</select> 

HTH。