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
 

 

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: 8593
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 Testing rerad cursor for status with ... John F Dutcher DB2 7 Fri May 19, 2017 9:35 pm
No new posts Getting -504 Cursor Name GTT-ARTS-CUR... Robin Sulsona DB2 2 Fri Mar 17, 2017 1:43 am
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
No new posts Release of Adabas Cursor mohitsethi All Other Mainframe Topics 1 Mon Feb 06, 2017 8:36 pm


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