Make Table read only
来源:互联网 发布:红色警戒mac版下载 编辑:程序博客网 时间:2024/05/01 13:30
Today I’ll show how we can make a table read only using database triggers
In this example, we’ll create a table, insert data in it, and then create trigger to prevent any insert, update or delete statement on table
SQL> CREATE TABLE tbl_read_only (id NUMBER);
Table created.
SQL> INSERT INTO tbl_read_only VALUES(1);
1 row created.
SQL> COMMIT;
Commit complete.
SQL> SELECT * FROM tbl_read_only;
ID
———-
1
SQL> CREATE TRIGGER trg_tbl_read_only BEFORE DELETE OR INSERT OR UPDATE
2 ON tbl_read_only
3 BEGIN
4 RAISE_APPLICATION_ERROR(-20202,’Table Status: READ ONLY!!!’);
5 END;
6 /
Trigger created.
SQL> INSERT INTO tbl_read_only VALUES(2);
INSERT INTO tbl_read_only VALUES(2)
*
ERROR at line 1:
ORA-20202: Table Status: READ ONLY!!!
ORA-06512: at “KAMRAN.TRG_TBL_READ_ONLY”, line 2
ORA-04088: error during execution of trigger ‘KAMRAN.TRG_TBL_READ_ONLY’
SQL>
In this example, we’ll create a table, insert data in it, and then create trigger to prevent any insert, update or delete statement on table
SQL> CREATE TABLE tbl_read_only (id NUMBER);
Table created.
SQL> INSERT INTO tbl_read_only VALUES(1);
1 row created.
SQL> COMMIT;
Commit complete.
SQL> SELECT * FROM tbl_read_only;
ID
———-
1
SQL> CREATE TRIGGER trg_tbl_read_only BEFORE DELETE OR INSERT OR UPDATE
2 ON tbl_read_only
3 BEGIN
4 RAISE_APPLICATION_ERROR(-20202,’Table Status: READ ONLY!!!’);
5 END;
6 /
Trigger created.
SQL> INSERT INTO tbl_read_only VALUES(2);
INSERT INTO tbl_read_only VALUES(2)
*
ERROR at line 1:
ORA-20202: Table Status: READ ONLY!!!
ORA-06512: at “KAMRAN.TRG_TBL_READ_ONLY”, line 2
ORA-04088: error during execution of trigger ‘KAMRAN.TRG_TBL_READ_ONLY’
SQL>
- Make Table read only
- Table is 'read only'
- How to make form Read Only
- mysql的table is read only 解决方法
- mysql table is read only 解决
- 关于mysql Table * is read only错误
- ADF TABLE 和 ADF read only Table的转换
- Custom.pll example to make DFF read only
- 如何解决mysql的Table is read only错误
- mysql中Table is read only的解决
- mysql提示Table is read only的解决方法
- 如何解决mysql的Table is read only错误
- Ubuntu下mysql中Table is read only的解决
- mysql中Table is read only的解决方法
- mysql中“Table ‘’ is read only”的解决办法
- Mysql 出现Table‘xxx’is read only问题
- MySql出现#1036 – Table ‘ ‘ is read only 错误解决方法
- ERROR 1036 (HY000): Table 'teacher' is read only
- 用ModelSim仿真FIFO
- Block developers from using TOAD and other tools on production databases
- AspectC++
- MartyrsCemetery菜鸟感想一之Ubuntu下搭建CUDA开发环境
- 自写的非常不错的oracle语句 精选
- Make Table read only
- android错误 Android NAND: nand_dev_load_disk_state,
- 实现RTP协议的H.264视频传输系统
- 2012七种最最为流行的婚纱摄影的风格
- 修改tomcat的conf/server.xml解决网页乱码
- 使用c#创建php可以调用的dll
- js replace方法
- as3笔记
- java利用多线程实现异步调用