SQL Trigger showing error -
i created 2 tables 1 name courses create statement follows:
create table courses ( cid int, cname varchar(25), depid int, no_sems int, primary key(cid), foreign key(depid) references departments );
another name departments
follows:
create table departments ( did int, dname varchar(20), hod_id int, no_courses int, primary key (did) );
i wanted increment no_courses
when course added courses
table. hence created following trigger:
create trigger courseinc after insert on courses referencing new newcourse update department set no_courses = no_courses + 1 did = newcourse.depid
but keep getting message this:
error @ line 1: pls-00103: encountered symbol ";" when expecting 1 of following:
begin case declare end exception exit goto if loop mod null pragma raise return select update while with
<< close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe
symbol "exit" substituted ";" continue. 1. create trigger courseinc 2. after insert on courses 3. referencing new newcourse
i not sure wrong. please help.
Comments
Post a Comment