Click to See Complete Forum and Search --> : Trigger Problem


Srinivas_Sharma
09-30-2003, 10:07 AM
I got a schema called Gary and another called SS
I m creating this trigger by loggin on to SS on Gary.G_Diary

what privileges do i need to have if any required.

If an insert is performed on Gary.G_DIARY i m inserting into my local table. I want to acheive this...but i m getting problems with :new and :old variables.

:new.gary.g_diary.columnname (can this be given)

Below is the code, Could anyone pl let me know whas wrong here.

Create or Replace Trigger Gdiary_ict
After Insert or Update or Delete on GARY.G_DIARY
for each row
declare
v_msg varchar2(100);
all_day varchar2(1);
recs number(8);
Begin
if inserting then
insert into G_DIARY_local (event_id,room_no,event,event_date,all_day,start_hour,start_mins)
values(ghall_eventdiary.nextval,:NEW.G_DIARY.ROOM_NO,:NEW.G_DIARY.EVENT,
:NEW.g_diary.event_date,'Y',:NEW.G_DIARY.HOUR_VALUE,:NEW.G_DIARY.HOUR_MINS);
end if;
end;

tamilselvan
09-30-2003, 01:08 PM
Do you have "CREATE ANY TRIGGER" priv?

Tamil

Srinivas_Sharma
09-30-2003, 01:16 PM
Hi,

I want to create trigger in my schema.

SS

tamilselvan
09-30-2003, 02:19 PM
Let Gary should create public synonym on his table.

Then SS can reference the refer table w/o qualifier in the trigger.
I think it will work. I will also do my test.

Tamil

tamilselvan
09-30-2003, 02:35 PM
OK. I tested and it worked.

SS should have "CREATE ANY TRIGGER" priv, because SS is creating a trigger on a table that he has not owned.

You do not need use :NEW.tablename.columnname.
Just use :NEW.COLUMNAME.


Tamil

Srinivas_Sharma
10-01-2003, 08:38 AM
Thanks Tamil for the info.

got it working :)

SS