Writting trigger in PlPgsql
Posted on 2006-11-05
I am new to postgresql and is trying to implement trigger.
I have a master table EmpMaster where the primary key EmpId is a auto incremented field.
I want to insert a new entry in the transaction table LeavesDetails as an when a new employee joins in.
On the execution of insert statement
insert into EmpMaster(empName,deptName,location) values('John','DeptAcc','Head office')
i want a new entry for the same employee be made in the leavesDetails table through a trigger.
My problem is how do i refer to newly generated EmpId from EmpMaster table . In MSSQL there is a concept of magic tables (inserted, deleted). How does one handle it in plpgSQL.
thanks in advance