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

To insert multiple rows in temporary table


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Nov 17, 2008 1:44 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Nov 17, 2008 1:56 pm
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Load new table with Old unload - DB2 DB2 6
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top