Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2013
    Posts
    39
    Provided Answers: 2

    Unanswered: Lock the column or make the column read only

    Hi,

    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    "CORE 11.2.0.2.0 Production"
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    I am not sure whether we can lock the column of table in Oracle or make the column read only. is there a way to stop the column to be getting inserted...Please suggest. Thanks...

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    You can DENY selects on or updates to a column, but to force a column to not be populated with an insert statement might require an AFTER INSERT trigger.

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    If a column is "read only", then how do you get any initial value into it to start with?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Alternatively instead of making the column READ ONLY, consider making the column WRITE NEVER
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Do you mean to make it unwritable by specific users? To disable a specific column on insert doesn't make a lot of sense. Simply drop the column. If you mean don't allow an update on a column then the easiest way is with a trigger with the clause

    Code:
    :new.column_name := :old.column_name;
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •