Here i have two tables
1> attendenace--column-->empid,indate,outdate..............
2> employees--column---> empid..........
i AM required to insert all the employee id's(frm employee table) into attendance table that are not present attendace table for given indate(date)
as other column for the newly inserted empid will be allocated with nulls i have to convert them to 0's
Now the problem is if i run this trigger after the first insert all the other employees are set to zeros so i probably have to run a time based trigger which i am not aware of can u help me:
i have come this far please make the correction for the code:
---------------------------------------------------------------------------
CODE
----------------------------------------------------------------------------
Quote:
CREATE TRIGGER test AFTER INSERT on attendance
FOR EACH ROW
BEGIN
insert into attendance(empid,indate) values(employee.empid,sysdate) where empid= (select empid from employee where empid not in(select empid from attendence where indate=sysdate)) ;
UPDATE table attendance SET field=0 WHERE field IS NULL;
end;
|
------------------------------------------------------------------------------------