By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,227 Members | 1,025 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,227 IT Pros & Developers. It's quick & easy.

What's wrong with the following set of commands and why

P: n/a
Hi,

I am facing some issues with the following set of commands.
The last 'Select' statement gives the error
"SQL0511N The FOR UPDATE clause is not allowed because the table
specified by
the cursor cannot be modified. SQLSTATE=42829

SQL0511N The FOR UPDATE clause is not allowed because the table
specified by the cursor cannot be modified."

Please explain why is this happening?

create table test1(num INTEGER);
create table test2(num2 INTEGER);

insert into test1 values(1);
insert into test2 values(1);

commit;

select test1.num from test1, test2 where test1.num = test2.num2 for
update with RS;

Thanks

Rahul Babbar

Oct 23 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Oct 23, 1:11 pm, Rahul Babbar <rahul.babb...@gmail.comwrote:
Hi,

I am facing some issues with the following set of commands.
The last 'Select' statement gives the error
"SQL0511N The FOR UPDATE clause is not allowed because the table
specified by
the cursor cannot be modified. SQLSTATE=42829

SQL0511N The FOR UPDATE clause is not allowed because the table
specified by the cursor cannot be modified."

Please explain why is this happening?

create table test1(num INTEGER);
create table test2(num2 INTEGER);

insert into test1 values(1);
insert into test2 values(1);

commit;

select test1.num from test1, test2 where test1.num = test2.num2 for
update with RS;
[db2inst1@53dbd181 ~]$ db2 "? SQL0511N"
[...]
On the database manager, the result table is read-only if the
cursor is based on a VALUES statement or the SELECT statement
contains any of the following:
[...]
o A FROM clause that identifies one of the following:
- More than one table or view
[...]
/Lennart
Oct 23 '07 #2

P: n/a
On Oct 23, 8:31 pm, Lennart <Erik.Lennart.Jons...@gmail.comwrote:
On Oct 23, 1:11 pm, Rahul Babbar <rahul.babb...@gmail.comwrote:
Hi,
I am facing some issues with the following set of commands.
The last 'Select' statement gives the error
"SQL0511N The FOR UPDATE clause is not allowed because the table
specified by
the cursor cannot be modified. SQLSTATE=42829
SQL0511N The FOR UPDATE clause is not allowed because the table
specified by the cursor cannot be modified."
Please explain why is this happening?
create table test1(num INTEGER);
create table test2(num2 INTEGER);
insert into test1 values(1);
insert into test2 values(1);
commit;
select test1.num from test1, test2 where test1.num = test2.num2 for
update with RS;

[db2inst1@53dbd181 ~]$ db2 "? SQL0511N"
[...]
On the database manager, the result table is read-only if the
cursor is based on a VALUES statement or the SELECT statement
contains any of the following:
[...]
o A FROM clause that identifies one of the following:
- More than one table or view
[...]

/Lennart
However,

The statement
"select test1.num from test1 for
update with RS; "

does work fine....the problem seems to come only if you try to have a
select involving two tables.

Please explain a bit more on the above and what should be done to fix
it?

Rahul

Oct 24 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.