Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Update Query returine more then one row in Oracle

Posted on 2014-04-21
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 77

Accepted Solution

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

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

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 49

Expert Comment

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
This post first appeared at Oracleinaction  ( 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…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

704 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