Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
CURSOR to fetech only first 20 rows.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Prasad Toshniwal
Warnings : 1

New User


Joined: 05 May 2008
Posts: 4
Location: PUNE

PostPosted: Thu Sep 04, 2008 1:37 pm    Post subject: CURSOR to fetech only first 20 rows.
Reply with quote

Hi,

There is one table containing 50 rows and i want to fetech only first 20 rows.

Is it necessary to use cursor here if yes then what would be my query and declarations if required.

Thanks,
Prasad
Back to top
View user's profile Send private message

anil.csk

New User


Joined: 22 Oct 2007
Posts: 16
Location: Noida

PostPosted: Thu Sep 04, 2008 1:40 pm    Post subject: Reply to: CURSOR query
Reply with quote

when you go declare the cursor
declare a1 cursor for select .....where ... for fetch first 20 rows.
Back to top
View user's profile Send private message
Prasad Toshniwal
Warnings : 1

New User


Joined: 05 May 2008
Posts: 4
Location: PUNE

PostPosted: Thu Sep 04, 2008 1:44 pm    Post subject:
Reply with quote

Anil,

Thanks. As i am new in DB2 could you please elaborate more on this.

Thanks,
Prasad Toshniwal
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8619
Location: Back in jolly old England

PostPosted: Thu Sep 04, 2008 1:50 pm    Post subject:
Reply with quote

Prasad Toshniwal

Please post in the correct forum.
Topic moved to the correct forum.
Back to top
View user's profile Send private message
anil.csk

New User


Joined: 22 Oct 2007
Posts: 16
Location: Noida

PostPosted: Thu Sep 04, 2008 1:55 pm    Post subject: Reply to: CURSOR query
Reply with quote

hi,
use the given link that will be use full for you for the cursor understanding.

http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/c0005280.htm
Back to top
View user's profile Send private message
umasankar.eee06

New User


Joined: 04 Sep 2008
Posts: 11
Location: chennai

PostPosted: Mon Sep 08, 2008 10:24 am    Post subject:
Reply with quote

Hi prasad,
U can use OPTIMIZE FOR 20 ROWS in fetch declaration.
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 Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Can we combine the rows with same key... V S Amarendra Reddy DB2 12 Fri Dec 01, 2017 10:29 pm
No new posts -502 Error - Cursor already open anand jeyapaul DB2 7 Sun Oct 29, 2017 4:22 am
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Conditional highlighting of rows in I... packerm CLIST & REXX 2 Thu Sep 21, 2017 6:50 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us