Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Can I limit the number or records to return given a condition?

Can I limit the number or records to return given a condition?

From: <antonyliu2002_at_yahoo.com>
Date: 14 Sep 2006 13:19:47 -0700
Message-ID: <1158265187.473605.162780@i42g2000cwa.googlegroups.com>


I need to update one field of T1 from T2. So, I tried this:

update T1 set (MyField) = (select distinct FunField from T2 where T1.ID = T2.ID);

T1's ID is a proper subset of T2's ID. In other words, each ID of T1 has a corresponding record in T2.

But, the problem is that, some IDs in T2 has multiple records, and as a result, I get this error:

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

T1 has nearly 7500 records and T2 has nearly 200,000 records. I've found some offending IDs from T2.

I am not sure how to handle this problem. Can I somehow limit the sub-query to return one and only one record given the condition?

Thanks in advance. Received on Thu Sep 14 2006 - 15:19:47 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US