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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ChancesAre
    New Member
    • Jul 2012
    • 1

    #1

    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_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.
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    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
    Code:
    :new."Updated_Date" := sysdate; 
    :new."Updated_By" := v_username;

    Comment

    Working...