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_Aud it
BEFORE INSERT OR UPDATE
ON VISITHISTORY
FOR EACH ROW
DECLARE
v_username varchar2(10);
BEGIN
v_username := user;
:new.Updated_Da te := sysdate;
:new.Updated_By := v_username;
END;
/
Warning: Trigger created with compilation errors.
show errors trigger PatientVist_Aud it;
Errors for TRIGGER PATIENTVIST_AUD IT:
LINE/COL ERROR
7/5 PLS-00049: bad bind variable 'NEW.UPDATED_DA TE'
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_commen ts
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.
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_Aud it
BEFORE INSERT OR UPDATE
ON VISITHISTORY
FOR EACH ROW
DECLARE
v_username varchar2(10);
BEGIN
v_username := user;
:new.Updated_Da te := sysdate;
:new.Updated_By := v_username;
END;
/
Warning: Trigger created with compilation errors.
show errors trigger PatientVist_Aud it;
Errors for TRIGGER PATIENTVIST_AUD IT:
LINE/COL ERROR
7/5 PLS-00049: bad bind variable 'NEW.UPDATED_DA TE'
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_commen ts
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.
Comment