Unix Technical Forum

the problem about load from cursor

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 ..." ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 06:03 AM
nier
 
Posts: n/a
Default 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!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 06:03 AM
Serge Rielau
 
Posts: n/a
Default Re: the problem about load from cursor

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 06:04 AM
nier
 
Posts: n/a
Default Re: the problem about load from cursor

Thanks very much, now it's OK.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:13 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com