Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple trigger...

Status
Not open for further replies.

kanghao

IS-IT--Management
Jul 4, 2004
68
KR
I have a trigger looks simmar like this.
GET_NAME is a function and works good.
What's wrong?

create or replace trigger trg_update_USER
after
update on USER
for each row
begin
if UPDATING then
UPDATE USER
set NAME = GET_NAME:)new.EMP_NO,:new.DEPT,'2')
where EMP_NO = :new.EMP_NO and :new.DEPT;
end if;
end;
 
Rename your table. USER is a reserved word. Then try again and let us know exactly what error you are getting.

[sup]Beware of false knowledge; it is more dangerous than ignorance.[/sup][sup] ~George Bernard Shaw[/sup]
Consultant Developer/Analyst Oracle, Forms, Reports & PL/SQL (Windows)
My website: Emu Products Plus
 
actually it's not "user".
but it seems a recursive trigger. doesn't it?
 
Isnt this what you want?

Code:
create or replace trigger trg_update_yourtable
after
update on yourtable
for each row
begin
if UPDATING then
    :new.NAME = GET_NAME(:new.EMP_NO,:new.DEPT,'2');
end if;
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top