473,385 Members | 1,429 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PLS-00049 bad bind variables??!!!!

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.
Jul 29 '12 #1
1 16088
rski
700 Expert 512MB
Looks like in the table columns Updated_Date and Updated_By names are case sensitive (notice that all column names in set that your select query returns are upper case and these two are not). This is not a good practice to create case sensitive column names.
In your trigger code try to do someting like that
Expand|Select|Wrap|Line Numbers
  1. :new."Updated_Date" := sysdate; 
  2. :new."Updated_By" := v_username; 
  3.  
Aug 27 '12 #2

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.