RE: Updating Table using select/ ORA-01427: single-row subquery returns more than one row error

RE: Updating Table using select/ ORA-01427: single-row subquery returns more than one row error

 

  

Try this:

select purchase_line_detail_descr
from temp_pop_lines t
where t.po_number=j.po_number
and t.po_line_number=j.po_line_number
group by purchase_line_detail
having count(*) > 1;

If anything comes up you have to further define your where statement or
delete the duplicates or write a pl/sql loop.



-----Original Message-----
From: Jim Thomas
[mailto:oracledba-ezmlmshield-x38064319.[Email address protected]
Sent: Monday, April 28, 2008 12:47 PM
To: LazyDBA Discussion
Subject: Updating Table using select/ ORA-01427: single-row subquery
returns more than one row error

Dear Lazy Dba's



Thanks to a couple of subscribers I was able to get the query
constructed properly

However now I am getting the:



ORA-01427: single-row subquery returns more than one row



I know what it is saying and I have tried a couple of fixes using the IN

operator. But I am still getting the same results- If anyone could

afford me a small portion of your valuable time, please review the query
below

and suggest to me where I may be wrong.



Original Query:



1 update jpt_pop_lines j

2 set purchase_line_detail_descr=(select purchase_line_detail_descr

3 from temp_pop_lines t

4 where t.po_number=j.po_number

5* and
t.po_line_number=j.po_line_number)

SQL> /

set purchase_line_detail_descr=(select purchase_line_detail_descr

*

ERROR at line 2:

ORA-01427: single-row subquery returns more than one row



I have used the IN statement in a variety of ways but I get the same
results-



If you can possibly manage the time for a response I will greatly
appreciate it.



Thank You

Regards

Jim Thomas



---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html



Oracle LazyDBA home page