ZdenekSmetana
ZdenekSmetana

Reputation: 49

compile error when creating an "instead of" trigger for a view

I've created an "instead of" trigger for a simple view that only does select * on a table and a trigger that does nothing (I wanted to minimize the problem):

create or replace view tmp(id, nazwa, nip, adres, zalega, punkty) as
select * from klient

create or replace trigger tmp_trg
instead of insert
on tmp
for each row
begin

end;

The view is created. Then when I want do declare this trigger sql developer returns error:

Error(8,1): PLS-00103: Encountered the symbol "END" when expecting one of the following: begin case declare exit for goto if loop mod null pragma raise return select update while with 'an identifier' 'a double-quoted delimited-identifier' 'a bind variable' << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe

Upvotes: 1

Views: 367

Answers (2)

Sathyajith Bhat
Sathyajith Bhat

Reputation: 21851

a trigger that does nothing (I wanted to minimize the problem):

I'm not sure I understand why you need a trigger if it does nothing ?

To answer, there isn't a valid PL/SQL statement in your trigger code block, add a NULL to make it a valid block and have no action.

create or replace trigger tmp_trg
instead of insert
on tmp
for each row
begin
NULL;
end;

Upvotes: 1

erbsock
erbsock

Reputation: 1217

just add "null;" between the begin and the end.

Upvotes: 5

Related Questions