Whenever a new record is created or updated, a validation is required that the salary of the person is in range according to job.
A Job table with job_id, job_title, min_salary, max_salary fields. An Employee table with employee_id, name, job_id and salary.
this is the trigger i'm trying to do:
CREATE OR REPLACE TRIGGER range_valid
BEFORE INSERT OR UPDATE
OF JOB_ID, SALARY ON EMPLOYEES
FOR EACH ROW
DECLARE
l_min_salary INTEGER;
l_max_salary INTEGER;
l_salary INTEGER;
BEGIN
SELECT MIN_SALARY, MAX_SALARY
INTO l_min_salary, l_max_salary
FROM JOBS
WHERE JOB_ID = :new.JOB_ID;
IF l_salary < l_min_salary OR l_salary > l_max_salary THEN
RAISE_APPLICATION_ERROR (
'Salario debe estar en el rango de' || l_min_salary || ' and ' || l_max_salary);
END IF;
END range_valid;
but it shows me the error:
Error(9,5): PL/SQL: Statement ignored
Error(9,5): PLS-00201: The identifier 'L_SALARY' must be declared
I don't know how to fix it.

Alter session set nls_language = 'english'in order to get the error message in English. - Wernfried Domscheit:new.salaryin if clause - Suresh