IBM DB2 UDB for z/OS Version 8 ROW_NUMBER() solution

| No TrackBacks

About IBM DB2 z/OS V.8 is not support row_number(). From DB2PORTAL Blog just use count() and temporary table to solve this problem. Use this sql statement to limit result range, like pre/next page effect.

SELECT DEPTNO, ROW#
FROM DEDBADM.DEPT TB1,
TABLE (SELECT COUNT(*) + 1 AS ROW#
FROM DEDBADM.DEPT TB2
WHERE TB2.DEPTNO < TB1.DEPTNO) AS TDEPT_TAB
WHERE ROW# BETWEEN 50 AND 60
ORDER BY DEPTNO
FETCH FIRST 10 ROWS ONLY
OPTIMIZE FOR 10 ROWS
WITH UR;

No TrackBacks

TrackBack URL: http://server.everfine.com.tw/blog/mt-tb.cgi/285

March 2010

Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Archives

Powered by Movable Type 4.34-en

About this Entry

This page contains a single entry by philipz published on February 12, 2010 1:07 PM.

Google Notebook Extension for Firefox 3.6+ was the previous entry in this blog.

JNDI Setting of Hibernate on Websphere 6.x is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.