New SQL syntax using the LIMIT
and OFFSET
clauses is now supported. The LIMIT
clause is helpful when you want to limit the number of records returned by an SQL statement. For example, if the table USERS has 100 records, but you want to return only five records, you can use the following statement:
SELECT * FROM users LIMIT 5 |
The OFFSET
clause indicates how many rows are skipped from the first row to start returning results. For example, if you want to return rows 11 to 15 from the table USERS, you can use the following statement:
SELECT * FROM users LIMIT 5 OFFSET 10 |
These two clauses are useful when you want to scroll through multiple page results in your code directly from the database rather than filtering them at the application tier.
The LIMIT
and OFFSET
clauses are enabled by default. However, if you find these clauses are not working, you can ensure they are enabled by executing the following commands:
$ db2set DB2_COMPATIBILITY_VECTOR=MYS $ db2stop $ db2start |
LIMIT, OFFSET 방식은 MySQL 방식인데 DB2 9.7 fixpak 2부터 지원한다.
다음과 같이 설정할 수도 있다.
|
그런데 인포센터에는 해당 내용이 명시되어 있지 않다.
http://www.ibm.com/developerworks/data/library/techarticle/dm-1006db2expressc972/index.html
http://stackoverflow.com/questions/8007243/documentation-for-db2-compatibility-vector-mys-in-db2
'Db2 > Db2 reference' 카테고리의 다른 글
DB2 9.7에서 온라인 백업 수행중 TRUNCATE 이슈 (0) | 2012.05.05 |
---|---|
What are the writes on temporary table spaces during the load phase of a LOAD command ? (0) | 2012.05.02 |
Compare the legacy JDBC driver with the new universal JDBC driver (0) | 2012.04.10 |
오라클의 REVERSE함수를 UDF로 구현 (0) | 2012.02.17 |
DB2LUW v8의 SQL 모니터링 (0) | 2012.02.13 |