oracle - I want to update T1 using T3 column and by using three table relationships -


update table1 t1 set t1.centername= (select ac.centername  table2 t2 inner join tablet3 on t2.centerid = t3.locationid  inner join table1 t1 on t3.log_id = t1.logid w here trunc(t1.row_date)='25-mar-2014'); 

this gives error 'ora-01427: single-row subquery returns more 1 row'.

the error message

ora-01427: single-row subquery returns more 1 row 

means, er, sub-query returns more row. is, part of statement ...

(select ac.centername  table2 t2 inner join tablet3 on t2.centerid = t3.locationid  inner join table1 t1 on t3.log_id = t1.logid  trunc(t1.row_date)='25-mar-2014')  

returns more row. error occurs because set part of update depends on equality operator - set t1.centername= - can take 1 value.

without more details data structure hard suspect want this

update table1 t1  set t1.centername= (select t2.centername                      table2 t2                              inner join table3 t3                         on t2.centerid = t3.locationid                      t3.log_id = t1.logid ) trunc(t1.row_date)='25-mar-2014' / 

(i've tidied redaction make aliases consistent.)


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -