Reputation: 1229
I have created a column within a table from which I would like to populate the table with data retrieved from another select statement.
This is the statement I am trying to use to populate that one column:
update cc_file
set sd_file_name = (select c1.name sd_file_name
from cc_file f, cvs3 c1
where f.sd_file_id = c1.file_id
and (c1.file_id, c1.type) in (select file_id,
max(type)
from cvs3
where type1='PP'
and type2='XHMTML'
group by file_id)
When I run this statement in Oracle it shows this error ORA-01427: single-row subquery returns more than one row
Please can someone let me know how I can do this so the column is updated.
Thanks
Upvotes: 0
Views: 144
Reputation: 13700
Try this
update cc_file
set xml_file_name = (select c1.name sd_file_name
from cvs3 c
where f.sd_file_id = cc_file.file_id and
(c.file_id, c.type) in (select file_id, max(type)
from cvs3
where type1='PP' and
type2='XHMTML'
group by file_id ))
Upvotes: 1