MyException - 我的异常网
当前位置:我的异常网» SQL » oracle sql 初记

oracle sql 初记

www.MyException.Cn  网友分享于:2013-02-20  浏览:4次
oracle sql 小记。
--select * from tab1 where acldate > to_date('2013-02-05','yyyy-mm-dd') and object_id='{04564890-64C7-4703-AC23-B324CDE01B69}'

--select * from tab2 where object_id ='{04564890-64C7-4703-AC23-B324CDE01B69}'


去重复
--select distinct owner,object_id,objecttype from downloadaccess 
--select count(1) from downloadaccess





--select * from downloadaccessdistinct

/**
insert into downloadaccessdistinct(owner,objecttype,objectstore,object_id)
select a.owner,a.objecttype,a.objectstore,a.object_id from (select distinct owner,objecttype,objectstore,object_id from downloadaccess) a
*/
create table downloadaccessDistinctTemp as (select distinct * from downloadaccess)



创建零时表
--create table downloadaccessDistinctTemp as (select distinct * from dmsos.downloadaccess)

--select * from dmsos.downloadaccess

--select count(*) from downloadaccessDistinctTemp

/**
insert into dmsos.downloadaccessdistinct(owner,objecttype,objectstore,object_id)
select a.owner,a.objecttype,a.objectstore,a.object_id from downloadaccessDistinctTemp a
**/
插入数据
--insert into dmsos.downloadaccess (select * from downloadaccessdistinctTemp)

--delete from dmsos.downloadaccess

删除数据
--truncate table dmsos.downloadaccess --drop storage nowait
oracle提醒nowait时 需要注销操作session

--select count(*) from dmsos.downloadaccess
--select session_id from v$locked_object

--select sid,serial#,username,osuser from v$session where sid = 18

--alter system kill session '18,48111'







文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有