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

Insert More than one row


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

New User


Joined: 16 Jun 2004
Posts: 47

PostPosted: Thu Sep 09, 2004 7:14 pm
Reply with quote

Hi,

I have a doubt can i insert more than one row thry application program? is it possible?

Regards
Lakshmi
Back to top
View user's profile Send private message
thunder

New User


Joined: 03 Sep 2004
Posts: 3

PostPosted: Thu Sep 09, 2004 7:33 pm
Reply with quote

hi lakshmi,

i think v cannot insert more than one row thru cobol . so far i had not came across such things. I shall try for it and reply soon.
icon_idea.gif
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1210
Location: India

PostPosted: Sat Sep 11, 2004 9:15 am
Reply with quote

Dear Friend,

You can insert more than one rown from COBOL program. Try CURSOR technique.
Back to top
View user's profile Send private message
lkmona80

New User


Joined: 28 Sep 2004
Posts: 2
Location: bangalore

PostPosted: Tue Sep 28, 2004 4:11 pm
Reply with quote

[quote="mcmillan"]Dear Friend,

You can insert more than one rown from COBOL program. Try CURSOR technique.[/quote]
If u dont mind can u pl gv a small example for it.
Back to top
View user's profile Send private message
vikas4u

New User


Joined: 12 Aug 2004
Posts: 14
Location: bangalore

PostPosted: Thu Sep 30, 2004 11:02 am
Reply with quote

hi,
if u want to retrive more than 1 row thru cobol program then u have to use CURSOR.

CURSOR :- The basic function is to retrieve more than 1 rows from the
table.

CURSOR BLOCK :-
There r 4 blocks in cursor.
1st the cursor need to be declared by using DECLARE cmd.
2nd the cursor has to be opened by using OPEN cmd.
3rd the cursor has to fetch the rows by using FETCH cmg.
lastly the cursor has to be closed by using CLOSE cmd.

syntax :-
DECLARE:-
DECLARE CURSOR <cursor name> FOR SELECT <selection query>

OPEN :-
OPEN CURSOR <cursor name >

-----------
----------
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Sep 30, 2004 11:36 pm
Reply with quote

Here's 1 way to insert multi rows:

insert into newtbl
select *
from oldtbl
where acctno > 12345
Back to top
View user's profile Send private message
ksivapradeep

New User


Joined: 30 Jul 2004
Posts: 95

PostPosted: Sat Oct 02, 2004 4:56 pm
Reply with quote

hi vikas,

cant we retrive more than one row using SELECT query?

we can retrive only one row using CURSOR from the no.of rows which are retrived using SELECT query.i think CURSOR is only just like one pointer to the each row.becoz we will mention the host variables in the cursor it will retrive only one row by putting in loop it will retrive the rows one by one ok please check it out and if any thing is wrong let me know.

regards,
siva pradeep
Back to top
View user's profile Send private message
ConnoisseuR

New User


Joined: 06 Aug 2004
Posts: 8
Location: india

PostPosted: Tue Oct 05, 2004 9:24 am
Reply with quote

if you r making a full key select then the rows updated will be one.
but if you have a partial key then you can update multiple rows with a simple select query.



thanks
santosh
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 Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Insert system time/date (timestamp) u... DFSORT/ICETOOL 5
No new posts Identify Program Insert DB2 7
No new posts Insert trailer for non empty file only DFSORT/ICETOOL 6
No new posts Merge files with a key and insert a b... DFSORT/ICETOOL 6
Search our Forums:

Back to Top