1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

How to lock values in a particular column in a table?!

Discussion in 'SQL PL/SQL' started by Vicky, Mar 17, 2015.

  1. Vicky

    Vicky Forum Advisor

    Messages:
    261
    Likes Received:
    11
    Trophy Points:
    260
    Location:
    Chennai
    Hi..

    Cud U tel me How to lock values in a particular column in a table, so tat it can't be updated in future.,/!
     
  2. eras

    eras Active Member

    Messages:
    23
    Likes Received:
    9
    Trophy Points:
    90
    Location:
    Lithuania
    Code (SQL):

    CREATE OR REPLACE TRIGGER bu$tab$col
    BEFORE UPDATE ON some_table
    FOR each ROW
    BEGIN
       IF nvl(:OLD.col, 'X') <> nvl(:NEW.col, 'X') THEN
          raise_application_error(-20001, 'Not allowed');
       END IF;
    END;
     
     
  3. krasnoslobodtsev_si

    krasnoslobodtsev_si Forum Genius

    Messages:
    626
    Likes Received:
    129
    Trophy Points:
    810
    Location:
    Russian Federation
    What do you try to make?