-
first i have created a table named as "marks"
SQL> select * from marks;
NAME ID SUB1 SUB2 TOTAL
---------- --------- --------- --------- ---------
a1 1 2 3 5
a2 2 3 1 4
a3 3 5 1 6
a4 4 6 2 8
a5 5 1 2 3
a6 6 3 4 7
a7 7 1 8 9
7 rows selected.
and then i have created a view on marks table like this
create view marks_view as select * from marks where id<4;
the details of the marks_view:
SQL> select * from marks_view;
NAME ID SUB1 SUB2 TOTAL
---------- --------- --------- --------- ---------
a1 1 2 3 5
a2 2 3 1 4
a3 3 5 1 6
and then i have created a trigger like as follows
SQL> create trigger marks_view_updt instead of update on marks_view
2 for each row
3 begin
4 if :old.name != :new.name
5 then
6 update marks
7 set name = :new.name
8 where name = :old.name
9 ;
10 end if;
11 end; /
when i execute this command i got a following warning message
Warning: Trigger created with compilation errors.
if someone finds any problem in this please help me.
This only some small example but if this works i am going to implement this in my project.
thankyou
SrinivasM
-
is this the correct syntax to create a trigger?
Did you check sys.dba_errors to what errors you are getting?
-
you can also look at user_errors to find the errors.
Do a delete from user_errors;
Create trigger .......;
select * from user_errors;
Do you have that slash immediately after the " end; / " on line 11?
If you don't have that slash on a line by itself, that is an error.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|