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: 10374
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: 10374
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 Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Can we combine the rows with same key... V S Amarendra Reddy DB2 12 Fri Dec 01, 2017 10:29 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm
No new posts Updating multiple counts in trailer!! Vignesh Sid SYNCSORT 4 Mon Nov 06, 2017 1:04 pm

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