Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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:
Dell PowerEdge Servers
  #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


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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

IBM Developerworks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway