This is a discussion on the problem about load from cursor within the DB2 forums, part of the Database Server Software category; --> Be consider of efficiency, I want to use "load from cursor " instead of "insert into ... select ..." ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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! |
| |||
| 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 |