question

Rakesh_kp123 avatar image
Rakesh_kp123 asked

update a newly created column on same table

-4

update UC_OFCOM_HIST_TRANS_LOG set LOAD_DATE_TIME = (select to_char(to_date(substr(a.file_name,instr(a.file_name , '',1,4)+1,length(a.file_name)-instr(a.file_name,'',1,4)-4),'YYYYMMDDHH24MiSS'),'DD/MM/YYYY HH24:Mi:SS) from UC_OFCOM_HIST_TRANS_LOG);

getting an error: ORA-01427 Single-row subquery returns more than one row

sqloracle
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Steve Jones - Editor avatar image
Steve Jones - Editor answered

Your SELECT statement embedded in the parens returns more than one row. The UPDATE statement can't pick one of the rows, so it errors out. Whenever you make a statement like this, you need to ensure that a unique, single value is returned.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.