摘要: 查重: select no from table_name group by no having count(no)>1; 删除重复数据中id较大的数据: delete from table_name where no in (select no from table_name group by n 阅读全文
posted @ 2020-11-11 14:51 半夏、、、微凉 阅读(448) 评论(0) 推荐(0)
摘要: select @rownum:=@rownum+1 rownum, sys_organ.* from (select @rownum:=0) r, sys_organ order by sys_id desc; 更新某一字段等于所在行号: set @num = 0; update sys_organ 阅读全文
posted @ 2020-11-11 14:44 半夏、、、微凉 阅读(1484) 评论(0) 推荐(0)
摘要: 示例:同时获取所有含有层级关系机构的名称(当前表只有一个名称,且有层级关系node/pnode),然后插入到另一张表中。DECLARE CURSOR ybs IS SELECT organ_code "orc",node "pnode" FROM SYS_ORGAN; BEGIN FOR yb IN 阅读全文
posted @ 2019-11-01 16:04 半夏、、、微凉 阅读(178) 评论(0) 推荐(0)
摘要: --查表空间占用大小的sqlSelect b.file_name 物理文件名, b.tablespace_name 表空间, b.bytes/1024/1024 大小M,(b.bytes-sum(nvl(a.bytes,0)))/1024/1024 已使用M,substr((b.bytes-sum( 阅读全文
posted @ 2019-11-01 14:41 半夏、、、微凉 阅读(907) 评论(0) 推荐(0)
摘要: 1、复制表结构及其数据: create table table_new as select * from table_old 2、只复制表结构: create table table_new as select * from table_old where 1=2; 或者 create table 阅读全文
posted @ 2018-08-29 14:55 半夏、、、微凉 阅读(2154) 评论(1) 推荐(0)