473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Having requirement to fetch record number 500 to 1000 from a table

Hi,
I have environment for DB2 v8 in z/OS and created one table by using:
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE QUERY_ANALYSIS (
  2.    name varchar(50),
  3.    destination varchar(50),
  4.    description varchar(50),
  5.    nine_code varchar(50) ,
  6.    points varchar(50),
  7.    team varchar(50),
  8.    group1 varchar(50),
  9.    office varchar(50) ,
  10.    is_present INTEGER,
  11.    p_nine_code varchar(50) 
  12.    )
having no primary key.
and inserted about 10k records, now i want to fetch only record number 500 to 100.
What could be the option to get it using SPUFI?

Actually I am not a DB2 guy but my tool developed in JAVA is having requirement to scan DB2 database and fetch records in batch of records without knowing the database description like unique id, pk and all, so there should be some option like we have in mysql:
Expand|Select|Wrap|Line Numbers
  1. select * from some_table limit 500,1000;
Jun 16 '10 #1
1 2341
kleach
15
If you need record number access in db2, you should use an "identity" column in the table ddl. This will generate a rownum for each row for you.

Without this in place, you can try using "fetch first 1000" on your select to sample the data in the table, the throw out the first 499 with some other tool.

Coolness has been added in the most recent UDB where you can set Oracle compatability as in
Expand|Select|Wrap|Line Numbers
  1.   db2set DB2_COMPATIBILITY_VECTOR=ORA
Then
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM table
  2.      WHERE ROWNUM BETWEEN 20 AND 40;
works as expectd.

Good luck.
Jun 22 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: mickeyg | last post by:
How do I update all row with the record number. I want to do something like this update phone set id=recordnumber;
3
by: John Ortt | last post by:
> I have a table of dates in ascending order but with varying intervals. I > would like to create a query to pull out the date (in field 1) and then pull > the date from the subsequent record...
0
by: Carl | last post by:
I have a main form with navigation buttons on it and a label showing for example Record 1 of 15 using recordsetclone on it and eveything works fine. When I move through the records the record...
0
by: Scott269 | last post by:
So I've got an old MS Works database I imported into Access. I needed a primary key so I created a record number field that was just the record number I manually inserted when I entered it in the...
1
by: Scott269 | last post by:
So I've got an old MS Works database I imported into Access. I needed a primary key so I created a record number field that was just the record number I manually inserted when I entered it in the...
12
by: Martin Heuckeroth | last post by:
Hi Any idea on how to get a row number from the original table? We do a query and get a result. The row number from the result is different from the rownumber of the table the result originated...
16
by: usenet | last post by:
I want to be able to use the record numbers of a sub-form, are they available anyhow in VB (Access 2003)? I want to use the sub-form record number as *part* of the primary key for the table...
5
by: Stephen | last post by:
Hello, I have 2 tables, one contains log of all incoming phone calls, and the other one is simply a phone book. I want to fetch caller's name if it's already exist in the phone book, and if it...
3
by: blakerrr | last post by:
Hi All, I have a strange situation that I can't figure out. The task is quite simple, delete a record from a table. Here is my situation: I have a form called Order Create which cycles through...
1
by: afromanam | last post by:
Hello, Good morning, I have a question, hope someone can help me. I have a table with say, 5 columns, each named A,B,C,D,E The table was imported from Excel, so picture please this:
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.