468,272 Members | 1,985 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,272 developers. It's quick & easy.

the problem about load from cursor

Be consider of efficiency, I want to use "load from cursor " instead of
"insert into ... select ..."
so I write sql sentence like following:
declare mycor cursor for select a.a, a.b from table1 a , table2 b where
a.a=b.a and a.b=b.b with ur; --column a and b in
table1,table2 both are primary key
then
load from mycor of cursor insert into table2(a, b)

but this operation will get a error message:
SQL0668N Operation not allowed for reason code "3" on table "table2"
SQLSTATE=57016

I think it because the target table has been used in select sentence,
but I use "with ur" already!
Who can tell me why or how to implement it in another efficiency way ?

Thanks for any suggestion!

Feb 11 '06 #1
2 2764
nier wrote:
Be consider of efficiency, I want to use "load from cursor " instead of
"insert into ... select ..."
so I write sql sentence like following:
declare mycor cursor for select a.a, a.b from table1 a , table2 b where
a.a=b.a and a.b=b.b with ur; --column a and b in
table1,table2 both are primary key
then
load from mycor of cursor insert into table2(a, b)

but this operation will get a error message:
SQL0668N Operation not allowed for reason code "3" on table "table2"
SQLSTATE=57016

I think it because the target table has been used in select sentence,
but I use "with ur" already!
Who can tell me why or how to implement it in another efficiency way ?

Check out the ALLOW READ ACCESS mode of LOAD.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Feb 11 '06 #2
Thanks very much, now it's OK.

Feb 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Firehawk® | last post: by
7 posts views Thread by jane | last post: by
2 posts views Thread by SamSpade | last post: by
2 posts views Thread by Paul Cheetham | last post: by
5 posts views Thread by Paul Cheetham | last post: by
1 post views Thread by peteh | last post: by
1 post views Thread by Ultrak The DBA | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.