|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Starting with Triggers
Hello,
I have never writen a trigger before and need some advice. I have two tables and when data is inserted into table A then I need to insert the same data into table B along with the time. create or replace trigger shadowDepts after insert on depts begin insert into depts_shadow values(deptno,dname,sysdate) end; / except deptno and dname are the values of what was inserted into the original Table A. How do I access those values... I tried using ":new" but it gave me an error, I think because it is not a "for each row" trigger. Please let me know where I am going wrong, Thanks, Ryan |
|
#2
|
|||
|
|||
|
try that:
create or replace trigger shadowDepts after insert on depts for each row begin insert into depts_shadow values(:new.deptno,:new.dname,sysdate); end; / |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Starting with Triggers |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|