PLS-00357: Table,View Or Sequence reference not allowed in this context

12,953

The answer was in the comment, I just want to put it here in case somebody need it later.

BEGIN 
  UPDATE USER.TABLE_NAME 
    SET FIRSTNAME = v_firstname, 
        LASTNAME = v_lastname, 
        EMAIL = v_email, 
        PHONE = v_phone, 
        SYS_LASTMODF_DTTM = sysdate 
    WHERE USER.TABLE_NAME.ID = v_id 
      AND USER.TABLE_NAME.CODE= v_code 
      AND (USER.TABLE_NAME.FIRSTNAME != v_firstname 
        OR USER.TABLE_NAME.LASTNAME != v_lastname 
        OR USER.TABLE_NAME.EMAIL != v_email 
        OR USER.TABLE_NAME.PHONE != v_phone); 
COMMIT;
Share:
12,953
Carrie
Author by

Carrie

I'm working as a software engineer at Chicago.

Updated on June 04, 2022

Comments

  • Carrie
    Carrie almost 2 years

    I want to write an update procedure in my package body. It works fine before I added this IF statement. I want to check that only if the new value is different from the old value, I update it. Otherwise, I don't update it. Then I got this error: Error(39,22): PLS-00357: Table,View Or Sequence reference 'USER.TABLE_NAME.FIRSTNAME' not allowed in this context. Below is my procedure code:

    PROCEDURE updateTABLE (
      v_code        IN      USER.TABLE_NAME.CODE%TYPE,
      v_id          IN      USER.TABLE_NAME.ID%TYPE,
      v_firstname   IN      USER.TABLE_NAME.FIRSTNAME%TYPE,
      v_lastname    IN      USER.TABLE_NAME.LASTNAME%TYPE,
      v_email       IN      USER.TABLE_NAME.EMAIL%TYPE,
      v_phone       IN      USER.TABLE_NAME.PHONE%TYPE
    ) IS
    BEGIN
    IF USER.TABLE_NAME.FIRSTNAME != v_firstname OR
       USER.TABLE_NAME.LASTNAME != v_lastname OR
       USER.TABLE_NAME.EMAIL != v_email OR
       USER.TABLE_NAME.PHONE != v_phone THEN
    UPDATE USER.TABLE_NAME
            SET FIRSTNAME = v_firstname,
                LASTNAME = v_lastname,
                EMAIL = v_email,
                PHONE = v_phone,
                SYS_LASTMODF_DTTM = sysdate
      WHERE USER.TABLE_NAME.ID = v_id AND
            USER.TABLE_NAME.CODE= v_code;
    
    END IF;
    COMMIT;
    END updateTABLE;
    

    Wondering how should I fix it? Did some search here but didn't find what I need.