Update Query returine more then one row in Oracle

Posted on 2014-04-21
Last Modified: 2014-04-25
I need update all values on one table as T where there exist certain condition on other table.

I know this query is wrong but how do I get it to work in Oracle update statement if the select statement between () returns a value

update sample s set s.L_INVOICE_FLAG  = 'T' where (s.project like (select from project p inner join sample s on = s.project where p.closed = 'T' and p.status = 'V'))
Question by:gilnari
  • 2
LVL 76

Accepted Solution

slightwv (䄆 Netminder) earned 500 total points
ID: 40013720
Not sure I follow the logic but try IN.

...  where (s.project like (select ...
...  where (s.project in (select ...
LVL 48

Expert Comment

ID: 40013987
and then also remove the inner join as it won't be required
UPDATE sample s
WHERE s.project IN (
		FROM project p
		WHERE p.closed = 'T' AND p.STATUS = 'V'

Open in new window


Expert Comment

ID: 40014273
... where (s.project like ...
... on = s.project  ...
are duplicated.
So it should be like this:
update sample s set s.L_INVOICE_FLAG  = 'T' where s.project in (select from project p where p.closed = 'T' and p.status = 'V')
you can not use 'like' against sub-query.
LVL 48

Expert Comment

ID: 40014920
did I not propose exactly the same query?

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Last record chosen in Oracle Query 3 54
Oracle regular expression 6 47
How do I get sql developer to give me valuable exception information? 2 46
Oracle Pivot Question 8 45
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now