Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to change this to an update script

Posted on 2011-09-28
4
Medium Priority
?
254 Views
Last Modified: 2012-05-12
I need to change what was posted in this link to an update statement where SET Records = 'T'

http://www.experts-exchange.com/Database/Oracle/Q_27343597.html
0
Comment
Question by:gilnari
  • 2
4 Comments
 

Author Comment

by:gilnari
ID: 36718137
Should have stated the table to update is PRODUCT and the field to update is Removed
0
 
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 36718160
That question selects from a table called analysis.

What are the tables linked?  in other words, what columns in analysis cause removed to be updated to a 'T' in product?
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 2000 total points
ID: 36718195
i'll take a guess based on previous questions but I too am confused as to the connection.
particularly since the link above points to removed='F'  but here you're setting it to 'T'


UPDATE product
   SET removed = 'T'
 WHERE analysis IN
           (SELECT name
              FROM (SELECT a.*,
                           ROW_NUMBER() OVER (PARTITION BY name ORDER BY version DESC) rn,
                           COUNT(*) OVER (PARTITION BY name) cnt
                      FROM analysis a)
             WHERE cnt > 1 AND NOT (rn = 1 AND removed = 'F'))
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 36718204
if that's not correct,  please supply the column(s) needed to connect product to analysis.
and, if there are any other conditions that apply
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question