View previous topic :: View next topic
|
Author |
Message |
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
if You expect to fetch multiple rows You should use a cursor |
|
Back to top |
|
|
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
yes I am using a cursor to fetch. but for inserting muyltiple rows should I use cursor? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
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 |
|
|
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
AFAIK an insert must contain values clause. Just that I am curious, can you please post your insert statement? |
|
Back to top |
|
|
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
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 |
|
|
|