I keep getting the bad bind variable errors & I don't understand why. Any help?
Below is my code for the trigger and its output.
SET ECHO ON
REM*********************************************** ***************
REM Create Trigger
REM
REM This trigger tracks who is updating the Patient's Visits info
REM
REM
REM*********************************************** ***************
Prompt Creating data entry audit trigger on Patient Visits
Creating data entry audit trigger on Patient Visits
CREATE OR REPLACE TRIGGER PatientVist_Audit
BEFORE INSERT OR UPDATE
ON VISITHISTORY
FOR EACH ROW
DECLARE
v_username varchar2(10);
BEGIN
v_username := user;
:new.Updated_Date := sysdate;
:new.Updated_By := v_username;
END;
/
Warning: Trigger created with compilation errors.
show errors trigger PatientVist_Audit;
Errors for TRIGGER PATIENTVIST_AUDIT:
LINE/COL ERROR
7/5 PLS-00049: bad bind variable 'NEW.UPDATED_DATE'
8/5 PLS-00049: bad bind variable 'NEW.UPDATED_BY'
This is the table and the fields within it.
SELECT table_name, column_name
FROM user_col_comments
WHERE table_name = 'VISITHISTORY' ;
TABLE_NAME COLUMN_NAME
VISITHISTORY VISITID
VISITHISTORY PATIENTID
VISITHISTORY STATEDCOMPLAINT
VISITHISTORY FINDINGS
VISITHISTORY VISITDATE
VISITHISTORY RX_PRESCRIBED
VISITHISTORY DIAGNOSISID
VISITHISTORY NOTE
VISITHISTORY Updated_Date
VISITHISTORY Updated_By
10 rows selected.