Class 12_2 Oracle 11g: Alter Table Read Only

In today’s discussion, we will talk about the following.

  • Alter table read only.

 

What is read only? Why we need to alter the table into read-only? These are some important question that comes into one’s mind.

As you know, you can alter the table as well as you can add, delete, and modify columns and their data types. However, today I’ll tell you that you can also convert the table in read-only mode. This read-only status of the table will disable the box (Object) from any modification of any record that is already available in the table.

Why we need to change table read only?

We usually do this cause we do not allow anyone to modify the information that we already have. Generally we do this for reporting tables.

Let’s make it more concrete by completing an example.

Examples:

ALTER TABLE SCOTT.EMP READ ONLY;
SELECT * FROM SCOTT.EMP;
UPDATE SCOTT.EMP SET SAL=1000 WHERE EMPNO=7369;
ALTER TABLE SCOTT.EMP READ WRITE;

First pick the table that you want to convert it into read-only. In our case we have chosen SCOTT.EMP3

ALTER TABLE SCOTT.EMP3 READ ONLY;

Note: Scott.emp3 is the table name you can replace with your table name.

Alter the table into read-only:

Related Post

Trying to delete the data from read-only table (SCOTT.EMP3) and getting following Error.

ERROR at line 1:

ORA-12081: update operation not allowed on table “SCOTT”.”EMP3″

We are trying to update the read-only table and getting following error which means that this table is read-only.

ERROR at line 1:

ORA-12081: update operation not allowed on table “SCOTT”.”EMP3″

In order to resolve this error or back table into read and write mode, you need to run the following query if you have privileges otherwise contact you DBA.

ALTER TABLE SCOTT.EMP3 READ WRITE;

Note: Scott.emp3 is a table name you can replace with your table name.

alter table table_name read write ;

I hope today we have covered this Read only feature.




  • Rameez

    Recent Posts

    Heart Attack Causes and its Solution

    What is the Main Cause of a Heart Attack? What is its Solution? A heart attack is the blockage of… Read More

    8 months ago

    Understanding the Debt Ceiling: Its Impact, Importance, and Implications

    In the vast economic arena, one term that often takes center stage, inciting extensive debates and discussions, is the "debt… Read More

    1 year ago

    De-Dollarization: The New World Order of Currency and Its Global Impact

    De-Dollarization: The Changing Face of Global Finance The financial landscape is in a state of flux, with an intriguing economic… Read More

    1 year ago

    Unstoppable Bayern Munich: The Story Behind Their 11th Consecutive Bundesliga Title

    The curtains closed on a dramatic Bundesliga season with Bayern Munich standing tall once again, clinching their 11th straight title.… Read More

    1 year ago

    Celine Dion Cancels Concert Tour Due to Deteriorating Stiff-Person Syndrome

    The Unfolding Story of Celine Dion's Health In recent news that has left fans across the globe stunned, iconic singer… Read More

    1 year ago

    Navigating the Crossroads: LeBron James, Anthony Davis, and the LA Lakers’ Uncertain Future

    As the echoes of the recent NBA season start to fade, the attention of enthusiasts is firmly glued to one… Read More

    1 year ago