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
 

 

Insert More than one row

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Insert More than one row
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    Post subject: insert more....
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: 1202
Location: India

PostPosted: Sat Sep 11, 2004 9:15 am    Post subject: Re
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    Post subject: Re: Re
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    Post subject: USE CURSOR
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    Post subject:
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    Post subject: Re: USE CURSOR
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    Post subject:
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    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 Insert Lines in JCL with Rexx after a... Willy Jensen CLIST & REXX 3 Tue Aug 30, 2016 4:18 pm
No new posts How to insert a lengthy string havin... vidyaa DB2 7 Thu Aug 25, 2016 5:20 pm
No new posts How do I right justify a string in an... rakesh17684 DB2 1 Wed Jun 08, 2016 8:01 pm
No new posts insert the same records but chancing ... danylele74 DB2 6 Mon May 02, 2016 7:22 pm
No new posts Can a DB2 insert trigger execution of... TS70363 DB2 6 Tue Nov 24, 2015 10:44 pm


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