1、给某列加注释
comment on column emp.ename is '员工姓名';
select comments,COLUMN_NAME from user_col_comments where table_name='EMP';
2、约束异常EXCEPTION实验
create table test(c1 number,c2 char(10));
insert into test values(1,'aaa');
commit;
alter table test add constraints u_name unique(c2); 增加Unique约束
insert into test(1,'aaa');
insert into test values(2,'aaa'); 插入该数据会提示违反约束
alter table test disable constraints u_name; 先将该约束禁用
insert into test values(2,'aaa'); 可以插入该数据
至RDBMS/ADMIN/utlexcpt.sql中调用建表exceptions脚本
create table exceptions(row_id rowid,
owner varchar2(30),
table_name varchar2(30),
constraint varchar2(30));
alter table test enable constraint u_name exceptions into exceptions; 将异常的表导入exceptions便插入该数据
select ROW_ID from exceptions;
select rowid,c1,c2 from test where rowid in(select ROW_ID from exceptions); 从异常的表读取rowid
update test set c2='bbbb' where rowid='AAAM1CAAEAAAAGlAAB'; 找出异常数据修改或删除
truncate table exceptions; 从异常表删除数据
5月19日实验