I have been using mysql and informix databases before. It is very simple to look up the first 10 pieces of data in the table: This article mainly introduces the relevant information of Oracle and Mybatis to achieve the 10 pieces of data from the table. Friends who need it can refer to it. I hope it can help. Everyone.
Original version:
select top * from student
select top * from table where score > 80
select * from student where rownum < 10
select * from( select rownum rn,A.* from student where score > 80) where rn < 10
<select id="selectStudent" parameterType="hashmap" resultMap="BaseResultMap"> select * from ( select rownum rn, A.* from student A where STATUS = '99' and score <![CDATA[>]]> #{scores,jdbcType=INTEGER}) where rn <![CDATA[<=]]> #{number,jdbcType=INTEGER} </select>
ps: mybatis takes Oracle sequence, the same value problem processing
<select id="getCode" resultType="java.lang.String"> select 'TRD'||to_char(sysdate,'yyyymmdd')||lpad(to_char(SQ_ORD_PURCHASE_ID.nextval), 5, '0') code from dual </select>
useCache="false" flushCache="false" Attribute:
<select id="getCode" resultType="java.lang.String" useCache="false" flushCache="false"> select 'TRD'||to_char(sysdate,'yyyymmdd')||lpad(to_char(SQ_ORD_PURCHASE_ID.nextval), 5, '0') code from dual </select>
How to change the data file location of the table space in Oracle
How to modify the order of fields in the Oracle database table
oracle query table name and table column name
The above is the detailed content of Oracle combines Mybatis to obtain 10 pieces of data from the table. For more information, please follow other related articles on the PHP Chinese website!