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
 

 

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: 10274
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: 10274
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 Changeman get multiple "Browse C... elixir1986 Compuware & Other Tools 4 Fri Jul 14, 2017 1:48 am
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 16 Thu Jul 13, 2017 2:11 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm


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