create or replace trigger Employess_salaries
before insert on employee
for each row
declare
checksal number;
begin
select count(*) into checksal from emploee e where e.empid=:new.empid and e.salary=:new.salary
if checksal=0 then
insert into zsalarycheck(id,cdate,empid,salary) values (zsalarycheck_seq.nextval,sysdate,:new.empid,:new.salary)
end if;
end
create table zsalarycheck
(
ID NUMBER(10) not null,
cdate date,
empid NUMBER(10) not null,
salary float,
)
create sequence zsalarycheck_SEQ
minvalue 1
maxvalue 2147483647
start with 1
increment by 1
cache 10
cycle;
employee new_salary old_salary dt_changed osuser program
X 120 110 05/03/2012 XXX YYY
Y 200 180 05/03/2012 XXX YYY
Emp_Id
Alw_Ded_Id
Alw_Ded_Amount
From_Period
To_Period
Alw_Ded_Id
and
Alw_Ded_Amount
for current month and previous by using field
From_Period
with
To_Period
and what new things in Alw_Ded_Id added or removed in current month.tbl_EmpTest
CREATE OR REPLACE TRIGGER TRI_Emp
AFTER DELETE OR INSERT OR UPDATE
ON TBL_EmpTest
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
tmpVar NUMBER;
/******************************************************************************
NAME:
PURPOSE:
REVISIONS:
Ver Date Author Description
--------- ---------- --------------- ------------------------------------
1.0 17/03/2012 1. Created this trigger.
NOTES:
Automatically available Auto Replace Keywords:
Object Name:
Sysdate: 17/03/2012
Date and Time: 17/03/2012, 11:24:45 ¿, and 17/03/2012 11:24:45 ¿
Username: (set in TOAD Options, Proc Templates)
Table Name: (set in the "New PL/SQL Object" dialog)
Trigger Options: (set in the "New PL/SQL Object" dialog)
******************************************************************************/
BEGIN
tmpVar := 0;
SELECT MySeq.NEXTVAL INTO tmpVar FROM dual;
:NEW.SequenceColumn := tmpVar;
:NEW.CreatedDate := SYSDATE;
:NEW.CreatedUser := USER;
update tbl_EmpTest
set Emp_Id = 50
where
Emp_Id = 100;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
END ;
ORA-04098
Check out that the trigger has no errors before trying to execute.
ORA-04098: trigger 'string.string' is invalid and failed re-validation
Cause: A trigger was attempted to be retrieved for execution and was found to be invalid. This also means that compilation/authorization failed for the trigger.
Action: Options are to resolve the compilation/authorization errors, disable the trigger, or drop the trigger.
TRIGGER MOJ_PRD.TRI_BADR
On line: 26
PLS-00049: bad bind variable 'NEW.SEQUENCECOLUMN'
CREATE OR REPLACE TRIGGER TRI_EMP
AFTER DELETE OR INSERT OR UPDATE
ON TBL_EMPTEST
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
tmpVar NUMBER;
/******************************************************************************
NAME:
PURPOSE:
REVISIONS:
Ver Date Author Description
--------- ---------- --------------- ------------------------------------
1.0 17/03/2012 1. Created this trigger.
NOTES:
Automatically available Auto Replace Keywords:
Object Name:
Sysdate: 17/03/2012
Date and Time: 17/03/2012, 11:24:45 Õ, and 17/03/2012 11:24:45 Õ
Username: (set in TOAD Options, Proc Templates)
Table Name: (set in the "New PL/SQL Object" dialog)
Trigger Options: (set in the "New PL/SQL Object" dialog)
******************************************************************************/
BEGIN
tmpVar := 0;
/* SELECT MySeq.NEXTVAL INTO tmpVar FROM dual;
:NEW.SequenceColumn := tmpVar;
:NEW.CreatedDate := SYSDATE;
:NEW.CreatedUser := USER;*/
update TBL_EMPRESULT
set fld_EmpId = 50
where
fld_EmpId not in (select emp_id from tbl_EMPTEST where emp_id = 50);
COMMIT;
/* EXCEPTION
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;*/
END ;
ORA-04091: ÌÏæá TBL_EMPTEST íÊÛíÑ¡ ÞÏ áÇ íÔÚÑ Èå ÇáÒäÇÏ Ãæ ÇáæÙíÝÉ
ORA-06512: ÚäÏ "TRI_EMP", line 30
ORA-04088: ÙåÑ ÎØÇ ÃËäÇÁ ÊäÝíÐ ÇáÒäÇÏ TRI_EMP'
update TBL_EMPRESULT
set fld_EmpId = 50
where
fld_EmpId not in (select emp_id from tbl_EMPTEST where emp_id = 50);
COMMIT;
You can't handle files within oracle triggers.
What you can do is populate an results table from where you can after take your results through plsql in a text or excel file.
What kind of checks you want the trigger to make, what results do you need?
Give more info in order to help you.
Please feed back.