Oracle删除表中重复记录
--刪除重復列
a.如果有ID字段,就是具有唯一性的字段
delect table where id not in (
select max(id) from table group by col1,col2,col3...
)
group by 子句后跟的字段就是你用到判斷重复的字段
b.,如果是判斷所有字段
select * into #aa from table group by id1,id2,....
delete table table
insert into table
select * from #aa
c.如果表中有ID的情況
select identity(int,1,1) as id,* into #temp from tabel
delect # where id not in (
select max(id) from # group by col1,col2,col3...)
delect table
inset into table(...)
select ..... from #temp
col1+','+col2+','...col5 組合主鍵
select * from table where col1+','+col2+','...col5 in (
select max(col1+','+col2+','...col5) from table
where having count(*)>1
group by col1,col2,col3,col4
)
group by 子句后跟的字段就是你用到判斷重复的字段
d.
相关文档:
with
lockinfo as (
select distinct decode(sql_hash_value, 0, prev_hash_value, sql_hash_value) sql_hash_value, decode (sql_hash_value, 0, prev_sql_addr, sql_address) sql_address, s.sid, l.id1 object_id, l.block
from v$lock l, v$session s
&n ......
create or replace directory MY_DIR as '/usr/test/';
create or replace function f_exportTxt(
--传入参数
i_query in varchar2,
i_separator in varchar2,
i_dir in varchar2,
i_filename in varchar2
) return number
is
/**
** 函数名:f_exportTxt
&nbs ......
转自:http://hong9270503.blog.163.com/blog/static/1272923200916112245844/
学习oracle,最好首先了解Oracle的框架。这样对Oracle有一个整体的认识,有高屋建瓴的作用。
1、物理结构(由
控制文件、数据文件、重做日志文件、参数文件、归档文件、口令文件组成)
一个数据库中的数据存储在磁盘上物理文件, ......
TO_DATE格式(以时间:2007-11-02 13:45:25为例)
Year:
yy two digits 两位年 &n ......
在 Windows 上安装 Oracle 数据库 11g
安装Oracle 软件,必须使用 Oracle Universal Installer。
1.在这一安装中,您需要使用 DVD 或下载 DVD 版本。在本教程中,将从已下载的版本进行安装。在解压缩 DVD 文件的目录中,打开 Windows 资源浏览器并双击 \db\Disk1 目录的 setup.exe。
2.安装的产品为 Oracle Da ......