Home > database >  How Oracle according to the father and son two tables associated fields to update the data in the ta
How Oracle according to the father and son two tables associated fields to update the data in the ta

Time:10-12

Corresponding relations between two tables as follows: the parent table of Fid parentid for the child table, and as a one-to-many relationship, more than a Fid corresponding parentid, according to the corresponding relationship to the parent table M field value of the update to the child table FM in
The update child table set FM=
(select arjun from the parent table a inner join child table b on b. m=arjun) where FM is null
Will be prompted to ORA - 01427 single subquery return multiple rows, and rownum=1 is not an error, but the child table FM value is still empty, has not been updated, please advise!

CodePudding user response:

Update zi t1 set t1. FM=(select v1. M from fu v1 where t1. Parentid=v1. Fid)

CodePudding user response:

The update child table a FM=(select m from the parent table b where Amy polumbo arentid=b. id and rownum<2)
Where Amy polumbo arentid (select fid in the from the parent table)
  • Related