Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
To insert multiple rows in temporary table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
birdy K

New User


Joined: 05 Mar 2008
Posts: 72
Location: chennai

PostPosted: Mon Nov 17, 2008 1:41 pm    Post subject: To insert multiple rows in temporary table
Reply with quote

Hi,

I am inserting multiple rows in temporary table in cobol program. Then I am fetching each value. While fetching it is giving sqlcode 100 and there is no value.

But when i tried with inserting only one value alone. It gave me sqlcode 0. Please suggest me. The temporary table declaration is

Code:

EXEC SQL                                             
DECLARE GLOBAL TEMPORARY TABLE TEMPLOC               
  (LOCTN_CD CHAR(5) NOT NULL) ON COMMIT PRESERVE ROWS
END-EXEC                                             
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10308
Location: italy

PostPosted: Mon Nov 17, 2008 1:44 pm    Post subject: Reply to: To insert multiple rows in temporary table
Reply with quote

if You expect to fetch multiple rows You should use a cursor
Back to top
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 72
Location: chennai

PostPosted: Mon Nov 17, 2008 1:53 pm    Post subject:
Reply with quote

yes I am using a cursor to fetch. but for inserting muyltiple rows should I use cursor?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10308
Location: italy

PostPosted: Mon Nov 17, 2008 1:56 pm    Post subject: Reply to: To insert multiple rows in temporary table
Reply with quote

my bad for the previous reply ( I was doing neuronic multitasking )

status code 100 is a legitimate status code for no row fetched
which means.... no rows found for a single fetch
no more rows found for a cursor fetch

I guess You should review Your query

insert is an insert and has nothing to do with a cursor
Back to top
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 72
Location: chennai

PostPosted: Tue Nov 18, 2008 10:00 am    Post subject:
Reply with quote

Thank you enrico for your efforts. The problem has solved in multiple rows insert. The insert should not contain "values" keyword. That I removed and now it is working fine.
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Tue Nov 18, 2008 10:26 am    Post subject:
Reply with quote

AFAIK an insert must contain values clause. Just that I am curious, can you please post your insert statement?
Back to top
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 72
Location: chennai

PostPosted: Wed Nov 19, 2008 2:21 pm    Post subject:
Reply with quote

For multiple row insert , for ex

Code:

insert into table a (select * from table b);


Here "values " keyword is not need. You can try this.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PLI - printing from multiple programs Pedro PL/I & Assembler 8 Fri Sep 08, 2017 6:36 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us