oracle数据库小节

清除表里多余的数据,要先备份,再清

create table RULE_ROLE_FUNC_bak20140516 as select * from RULE_ROLE_FUNC;--备份语句
delete RULE_ROLE_FUNC r where r.role_code not in('R0666','R0777','R0888',,'R0002');--删除语句

我一不小心删多啦,恢复
insert into RULE_ROLE_FUNC select * from RULE_ROLE_FUNC_bak20140516 where (ROLE_CODE, ENTITY_TYPE, ENTITY_CODE) not in (select ROLE_CODE, ENTITY_TYPE, ENTITY_CODE from RULE_ROLE_FUNC);

ROLE_CODE, ENTITY_TYPE, ENTITY_CODE 为联合主键,保证数据不重复。

你可能感兴趣的:(oracle数据库小节)