常用SQL

 

    oracle表的回闪操作 

1.在9i上执行的操作

查询test表中记录
select * from test;
删除test表中记录
delete from test;
获得过去的会话
exec dbms_flashback.disable;
查询出3分钟前这个test表的情况
select * from test as of timestamp(systimestamp - interval '3' minute );
将查出的记录插入到误删除数据的表中
insert into test select * from test as of timestamp(systimestamp - interval '30' minute );

2.在10G上执行的操作
例:执行将test表闪回到2005年5月7日下午3点。
SQL>flashback table test to timestamp to_timestamp('2005-05-07 15:00:00','yyyy-mm-dd hh24:mi:ss');

 

------------------------------------------------------------------------------------------------------------------------------------------------

修改数据库中某些字段存在的空格
update laagent set name=replace(name,' ','') where agentcode='116000001'

------------------------------------------------------------------------------------------------------------------------------------------------

将A表中丢失的idno补全(从B表(备份表)中查询出相应的idno修改到A表中)    

update laagent z set z.idno =( select b.idno from laagentb b where b.agentcode=z.agentcode
      and b.idno is not null and b.branchtype='1'
      and edorno =(select max(edorno) from laagentb c where b.agentcode=c.agentcode and c.idno is not null))
     where z.idno is null
      and z.branchtype = '1'

-------------------------------------------------------------------------------------------------------------------------------------------------

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值