Update SQL with two tables in Oracle Update SQL with two tables in Oracle oracle oracle

Update SQL with two tables in Oracle


Maybe something like

UPDATE S_MUSTERISET TEMSILCI_KOD = 4WHERE TEMSILCI_KOD = 9AND EXISTS (SELECT 1 FROM S_TEKLIF BWHERE S_MUSTERI.HESAP_NO = B.HESAP_NOAND B.BAYI_KOD = 17)


In Oracle the syntax to update a view is different from SQL*Server's syntax. In Oracle you could issue the following query:

UPDATE (SELECT A.TEMSILCI_KOD          FROM S_MUSTERI A, S_TEKLIF B         WHERE A.TEMSILCI_KOD = 9           AND B.BAYI_KOD = 17           AND A.HESAP_NO = B.HESAP_NO)   SET TEMSILCI_KOD = 4

Note: This query will only work in Oracle if (S_TEKLIF.BAYI_KOD, S_TEKLIF.HESAP_NO) is unique (so that the update will not be ambiguous and each row from S_MUSTERI will be updated at most once).


Your update statement does not follow the correct syntax. There is no from clause in the update statement. It should follow the format

Update <table>    set <column> = <value>  where <conditions>

See this documentation on update:http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10007.htm#i2067715