Prevent update to column in a table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kam
    New Member
    • Mar 2007
    • 1

    Prevent update to column in a table

    Hi all,

    I don't know if this is possible. I have a table which has a CreatedBy column, but this column can't be changed once it is set. Is there any way we can tell oracle not to allow update to certain column in a table?

    Thanks for all the help.
  • rushdishams
    New Member
    • Mar 2007
    • 24

    #2
    you can apply column privileges on that table. if you want a single column not to be modified, then you can set privileges all other columns except that particular column.

    cheers!

    Comment

    • wel
      New Member
      • Apr 2007
      • 5

      #3
      working with column privileges or

      1. Create a view based on a select statement that doesn't iclude the column
      2. Grant users the update privilege on that view rather then the table

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        as per u
        data can be inserted only once
        right

        if it is the primary key

        try writing a trigger using count()

        using the sample format

        Code:
        create or replace trigger mytrig before insert or update or delete of SAL on emp
        .........
        ...........
        
        raise_application_error(-20001,'cant manipulate...!');
        
        end;
        hope it will work

        Comment

        Working...