Nathan,
To successfully create your trigger in Oracle's PL/SQL, you will need to make a few syntactical adjustments. Rather than my recapping Oracle PL/SQL's TRIGGER syntax here, it will more efficient (and satisfying for you) if you reconcile your code to a PL/SQL trigger-syntax diagram.
Amongst the more obscure issues to look out for in your code are:
1) Semi-colons must terminate each and every speparate statement in a PL/SQL block including (in your case) the end of IF statements (following your missing "END IF;" clause, UPDATE statements (at the end of the last WHERE clause), and the "END;" of the PL/SQL block itself.
2) "IF" statements must terminate with and "END IF;" clause
3) If you are running the code in SQL*Plus, then the PL/SQL block must terminate with a "/" on a line of its own, which instructs SQL*Plus to release the code to the PL/SQL interpreter to compile/interpret the preceding block.
4) Oracle UPDATE statements are more complicated than the example you assert, above. If you wish to UPDATE a table from contents of another table, you must embed a SELECT subquery in the SET clause. My attempt at fixing your UPDATE statement might be:
Code:
...UPDATE table1 n
SET (column2, column3, colum4) =
(SELECT t.column2, t.column3, t.column4
FROM table2 t
WHERE t.column1 = n.column1);
...
5) I am not aware of an Oracle function that supports "UPDATE (COLUMN1)" syntax.
So, combined with TRIGGER-syntax issues, your fixing the above issues should help, as well.
Let us know if/when you get the code running and your finished code format.
![[santa] [santa] [santa]](/data/assets/smilies/santa.gif)
Mufasa
(aka Dave of Sandy, Utah, USA)
[
Providing low-cost remote Database Admin services]
Click here to join
Utah Oracle Users Group on Tek-Tips if you use
Oracle in
Utah USA.