Иван Бишевац
Иван Бишевац

Reputation: 14671

PLS-00049: bad bind variable in UPDATE Trigger

I am trying to write a simple trigger in Oracle 11g Express Edition:

CREATE OR REPLACE TRIGGER EMPLOYEE_UPDATE 
BEFORE UPDATE ON EMPLOYEE
FOR EACH ROW
BEGIN
   :new.End_Date := SYSDATE;
END;

But it raises error:

Error(4,1): PLS-00049: bad bind variable 'NEW.END_DATE'

What is the problem with this simple trigger?

Upvotes: 0

Views: 5023

Answers (1)

Иван Бишевац
Иван Бишевац

Reputation: 14671

Somehow after rewriting CREATE TABLE EMPLOYEE statement problem disappeared. I had

CREATE TABLE EMPLOYEE
( "Employee_ID" NUMBER(6,0),
 "HireDate" DATE,
 "Salary" NUMBER(8,2),
 CONSTRAINT "EMPLOYEE_PK" PRIMARY KEY ("Employee_ID") ENABLE
 );

I deleted table and rewrote CREATE TABLE syntax without double quotes:

CREATE TABLE EMPLOYEE
( Employee_ID NUMBER(6,0),
 HireDate DATE,
 Salary NUMBER(8,2),
 CONSTRAINT EMPLOYEE_PK PRIMARY KEY (Employee_ID) ENABLE
 );

and problem disappeared.

EDIT: As @Sathya explained it's not somehow, in Oracle, an object name, when created with quotes surrounding it's name becomes case sensitive. My misunderstanding was problem.

Upvotes: 2

Related Questions