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
 

 

Use of 'Like' in Cursor Declration

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

New User


Joined: 11 Apr 2007
Posts: 5
Location: mumbai

PostPosted: Thu Apr 26, 2007 3:28 pm    Post subject: Use of 'Like' in Cursor Declration
Reply with quote

Hi.
I have cont-id field in my file as 12345

in my table thid id is like 12345A,12345B,12345C

i HAVE TO FETCH ALL THESE RECORDS FROM THE TABLE.
I want to use cursor for that.

What could be the cursor declaration?
Back to top
View user's profile Send private message

balanim

New User


Joined: 29 Nov 2006
Posts: 6
Location: India

PostPosted: Thu Apr 26, 2007 4:51 pm    Post subject: Re: Use of 'Like' in Cursor Declration
Reply with quote

you can use simple cursor declaration.

declare a host variable
DCL HOSTV char(4) init(1234);

then declare a cursor.
EXEC SQL DECLARE CURLIKE CURSOR FOR
SELECT FROM tablename

WHERE CONT-ID LIKE :HOSTV

FOR FETCH ONLY;

This example is for PL/I if you want for cobol change accordingly.

Hope this helps

Cheers
Bnim
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 Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts DB2 Stored Procedure - Dynamic SQL - ... GuyC DB2 2 Wed Feb 17, 2016 5:10 pm
No new posts ISREDIT - Position Cursor on the Comm... Tarique Anwer TSO/ISPF 5 Wed Feb 03, 2016 12:44 pm
No new posts Need a cursor to achieve the below re... sandeep kumar302 DB2 10 Tue Mar 31, 2015 10:52 am


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