Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 1st, 2003, 02:54 PM
minus0 minus0 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 3 minus0 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
pl/sql problem

Hello All,

I am trying to update the value of a field in a table using a sub query and running into issues. My script has a cursor defined with a subquery. I am defining this cursor with a FOR UPDATE clause and when I execute it, I am getting an error as

FOR UPDATE of this query expression is not allowed

I am including the actual script here so that it makes more sense as to what I am doing

declare

/*cursor mycur is select distinct app_id
from table1
where fld1 in (select fld1 from table2 where myfield = 'MYVALUE') for update;*/

cursor mycur is select distinct app_id
from table1 C,table2 D
where C.fld1 = D.fld2
AND myfield = 'MYVALUE' for update;

vc_id table1.app_id%type;
new_id table1.app_id%type;

begin

open mycur;
loop
fetch mycur into vc_id;
new_id := vc_id || '-OLD';
exit when mycur%notfound;
update table1
set app_id = new_id
where current of mycur;

-- dbms_output.put_line('existing ' || vc_id);
-- dbms_output.put_line('new ' || new_id);

end loop;
close mycur;
end;
/

again my question is - Is it possible to use a FOR UPDATE with a subquery or a join?

Appreciate your help

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > pl/sql problem

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap