IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

row selection


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kumar_ngl
Warnings : 1

New User


Joined: 05 Aug 2005
Posts: 50
Location: chennai

PostPosted: Wed Sep 14, 2005 11:57 pm
Reply with quote

hi all,


Select * from emp first only;

will this querry retreives the first row alone???

if it is right how abt the last row ...

kumar.p.v
Back to top
View user's profile Send private message
bakarthikeyan

New User


Joined: 21 Sep 2005
Posts: 6

PostPosted: Thu Sep 22, 2005 12:36 am
Reply with quote

No. This won't work out.
Back to top
View user's profile Send private message
nitin4.a

New User


Joined: 16 Aug 2005
Posts: 26

PostPosted: Thu Sep 22, 2005 10:31 am
Reply with quote

Hi


as said by bakarthikeyan its true ,this will not work but if u want to have first and last u use cursors
Back to top
View user's profile Send private message
kumar_ngl
Warnings : 1

New User


Joined: 05 Aug 2005
Posts: 50
Location: chennai

PostPosted: Thu Sep 22, 2005 10:35 am
Reply with quote

Can u tell me hw to use cursor to fetch the first row or last row alone

kumar.p.v
Back to top
View user's profile Send private message
nitin4.a

New User


Joined: 16 Aug 2005
Posts: 26

PostPosted: Thu Sep 22, 2005 11:00 am
Reply with quote

HI


you can use scrollable cursors ,declare them as
EXEC SQL DECLARE C1 SCROLL CURSOR FOR........

and then can use Fetch

the command is: EXEC SQL FETCH ABSOLUTE +5 C1......

for the fifth row

EXEC SQL FETCH ABSOLUTE -1 C1........

for the last row

and absolute -5 for the fifth row from last


Hope this will help you

regards
sonu
Back to top
View user's profile Send private message
kumar_ngl
Warnings : 1

New User


Joined: 05 Aug 2005
Posts: 50
Location: chennai

PostPosted: Thu Sep 22, 2005 12:36 pm
Reply with quote

thanks sonu...

Great help...

kumar.p.v
Back to top
View user's profile Send private message
nitin4.a

New User


Joined: 16 Aug 2005
Posts: 26

PostPosted: Thu Sep 22, 2005 12:48 pm
Reply with quote

Welcome


anytime


regards
Back to top
View user's profile Send private message
kumar_ngl
Warnings : 1

New User


Joined: 05 Aug 2005
Posts: 50
Location: chennai

PostPosted: Thu Sep 22, 2005 1:01 pm
Reply with quote

hi sonu,

If u have time..plz send me a sample cobol pgm which retreives and inserts table values

I can provide u ..if u want my mail id for that

thanks,
kumar.p.v
Back to top
View user's profile Send private message
nitin4.a

New User


Joined: 16 Aug 2005
Posts: 26

PostPosted: Thu Sep 22, 2005 1:11 pm
Reply with quote

hi

u want a pgm using scrollable cursors

whole

i can send you the sql part rest u can easly copy from any previous one using non-scrollable(simple) Cursor

give your id

regards
Back to top
View user's profile Send private message
kumar_ngl
Warnings : 1

New User


Joined: 05 Aug 2005
Posts: 50
Location: chennai

PostPosted: Thu Sep 22, 2005 3:28 pm
Reply with quote

thanx sonu..

here is my id.. kumar_pselvam@yahoo.co.in

kumar.p.v
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts $AVRS File Selection Screen All Other Mainframe Topics 0
No new posts Joinkeys conditional selection of rec... DFSORT/ICETOOL 6
No new posts sort with selection and updating the ... DFSORT/ICETOOL 1
No new posts Random selection of output data DFSORT/ICETOOL 10
No new posts Forcing a single (or no) selection wi... TSO/ISPF 5
Search our Forums:

Back to Top