Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Retriving frist N rows from a select in DB2 V6

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
thiagold

New User


Joined: 29 Nov 2005
Posts: 3

PostPosted: Wed Nov 30, 2005 4:24 pm    Post subject: Retriving frist N rows from a select in DB2 V6
Reply with quote

Im trying to retrive N rows from a select, but in DB2 version 6. It not alowed to use the "FETCH FIRST N ROWS ONLY" sintax and it do not recognize the ROWID or ROW_NUMBER() columns ou functions. I need do this in one SQL request. Another case is that should run without using any PK or similars. Example:

SQL Server: "SELECT TOP N * FROM (select * from table_a)"

Oracle: "SELECT * FROM (select * from table_a) ta WHERE ta.rownum <= N

Best regards
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Fri Dec 02, 2005 4:48 am    Post subject: Re: Retriving frist N rows from a select in DB2 V6
Reply with quote

icon_cry.gif This was always a problem before V7. I think you are out of luck on this one.

Anyone have any suggestions? icon_question.gif

If you find the solution, Please post it.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Fri Dec 02, 2005 11:24 am    Post subject: Select
Reply with quote

Hi frnd,

Whether ur shop wont update the versions r not??? bcz v r not clear with ur requirement... so without that RowNum,Fetch facility the only way is Primary key.. u too locked that.. then how my frnd..?????
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
This topic is locked: you cannot edit posts or make replies. DB2 query Using Recursion, Converting... smilewithashu2 DB2 3 Tue Jan 03, 2017 12:50 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us