Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle Update Syntax
BS wrote:
>> You miss a select, you should have something
>> along the line of:
>> update po_vendors
>> set po_vendors.attribute3 =
>> select to_char(contractorimport.contractorid)
>> from contractorimport
>> where po_vendors.num_1099 = contractorsimport.ssnnumber
>>
>> --
>> Regards,
>> Frank van Bortel
>>
>> Top-posting is one way to shut me up...
> > Not working... > > 1 update po_vendors > 2 set po_vendors.attribute3 = ( > 3 select to_char(contractorimport.contractorid) > 4 from contractorimport > 5* where po_vendors.num_1099 = contractorimport.ssnnumber ) > SQL> / > select to_char(contractorimport.contractorid) > * > ERROR at line 3: > ORA-01427: single-row subquery returns more than one row
update po_vendors
set po_vendors.attribute3 = (
select DISTINCT to_char(contractorimport.contractorid)
from contractorimport
where po_vendors.num_1099 = contractorimport.ssnnumber);
This is very basic SQL. You should look into taking a class or finding a mentor in your organization or join an Oracle users group.
Demos of this type of statement can be found in Morgan's Library at www.psoug.org under UPDATE STATEMENTS.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Mon Aug 21 2006 - 16:16:41 CDT