If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > SQL script to start search from a row number and next n number of records

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-03-04, 07:15
trk_itkid trk_itkid is offline
Registered User
 
Join Date: Mar 2004
Posts: 1
Question SQL script to start search from a row number and next n number of records

Hi,
I am working on a product which has to support multiple databases.
(Oracle, DB2, Sybase and PostGres). I am using hibernate package which provides multiple database connectivity. My requirement is that
I should write a SQL Query (select statement) which should start from a record number and should return me the next n number of records from that record. The constraint is that i cannot have the primary key to be a index of the record number and i dont have the option of having another column "index" in the table. Could you please get back if it can be done using sql as it has to support all the four mentioned databases.
Thank you in advance.
Reply With Quote
  #2 (permalink)  
Old 03-03-04, 07:18
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
perhaps you need to re-think your approach

relational databases do not use "record numbers"

the closest you can come is to select some rows, then sort them, and then perform some filtering based on relative positions within the sorted rows

but note that this filtering comes after the rows have already been selected and sorted
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 03-03-04, 07:57
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
This is off the question (Rudy has already answered it nicely), but that Hibernate package gets nicely roasted by Tom Kyte
here

Search for hibernate scary (without quotes) which gets 1 hit called "Develop Environment", which talks about Hibernate towards the bottom. I would have given a direct URL, but couldn't get it to work!
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On