Update mit Self-Join

Ich möchte eine Tabelle aktualisieren, um anzuzeigen, dass einige Zeilen übergeordnete Elemente anderer Zeilen sind. Daher habe ich der Tabelle eine "parentid" -Spalte hinzugefügt. Die folgende Abfrage findet alle Eltern:

SELECT ca1.id, ca2.id 
FROM contactassociations ca1
JOIN contactassociations ca2 ON (ca1.contactid = ca2.contactid)
where ca1.entitytable = 'EMPLOYER' AND
ca2.entitytable = 'CLIENT';

Aber wenn ich versuche, diese Syntax anzupassen, um das Update durchzuführen, funktioniert es nicht:

UPDATE contactassociations ca1
SET    ca1.parentid = ca2.id
JOIN  contactassociations ca2 ON (ca1.contactid = ca2.contactid)
WHERE ca1.entitytable = 'EMPLOYER' AND ca2.entitytable = 'CLIENT';

Ich bekomme:

Error starting at line 6 in command:
UPDATE contactassociations ca1
SET    ca1.parentid = ca2.id
JOIN  contactassociations ca2 ON (ca1.contactid = ca2.contactid)
WHERE ca1.entitytable = 'EMPLOYER' AND ca2.entitytable = 'CLIENT'
Error at Command Line:7 Column:28
Error report:
SQL Error: ORA-00933: SQL command not properly ended
00933. 00000 -  "SQL command not properly ended"
*Cause:    
*Action:

Beachten Sie, dass Zeile 7, Spalte 28 das Ende der Zeile "SET" ist.

Antworten auf die Frage(3)

Ihre Antwort auf die Frage