存储过程: CREATE OR REPLACE PROCEDURE PROC_ABC ( currency IN NUMBER, aysdate IN DATE, money OUT number ) AS BEGIN dbms_output.put_line('ok'); select 1 into money from dual; END; declare a number(21,6); begin PROC_ABC(1,sysdate,a); dbms_output.put_line(a); end; -- 注意:进出参数不能在存储过程中确定值范围
create or replace procedure abc
as
begin
dbms_output.put_line('ok');
end;
exec abc();
对于单个user和tablespace 来说, 可以使用如下命令来完成。
步骤一: 删除user
drop user drp cascade
说明: 删除了user,只是删除了该user下的schema objects,是不会删除相应的tablespace的。
步骤二: 删除tablespace
DROP TABLESPACE ts_drp INCLUDING CONTENTS AND DATAFILES;
删除表空间分为以下几种情况。
DELETE from clb_distributor where (code) IN ( SELECT code FROM clb_distributor GROUP BY code HAVING COUNT(code) > 1) AND ROWID NOT IN (SELECT MIN(ROWID) FROM clb_distributor GROUP BY code HAVING COUNT(*) > 1);
DELETE from clb_distributor_area where (distributor_code) IN ( SELECT distributor_code FROM clb_distributor_area GROUP BY distributor_code HAVING COUNT(distributor_code) > 1) AND ROWID NOT IN (SELECT MIN(ROWID) FROM clb_distributor_area GROUP BY distributor_code HAVING COUNT(*) > 1);
1、查找表中多余的重复记录,重复记录是根据单个字段(Id)来判断
select * from 表 where Id in (select Id from 表 group byId having count(Id) > 1)
2、删除表中多余的重复记录,重复记录是根据单个字段(Id)来判断,只留有rowid最小的记录
DELETE from 表 WHERE (id) IN ( SELECT id FROM 表 GROUP BY id HAVING COUNT(id) > 1) AND ROWID NOT IN (SELECT MIN(ROWID) FROM 表 GROUP BY id HAVING COUNT(*) > 1);
3、查找表中多余的重复记录(多个字段)
select * from 表 a where (a.Id,a.seq) in(select Id,seq from 表 group by Id,seq having count(*) > 1)
4、删除表中多余的重复记录(多个字段),只留有rowid最小的记录
delete from 表 a where (a.Id,a.seq) in (select Id,seq from 表 group by Id,seq having count(*) > 1) and rowid not in (select min(rowid) from 表 group by Id,seq having count(*)>1)
5、查找表中多余的重复记录(多个字段),不包含rowid最小的记录
select * from 表 a where (a.Id,a.seq) in (select Id,seq from 表 group by Id,seq having count(*) > 1) and rowid not in (select min(rowid) from 表 group by Id,seq having count(*)>1)
///////////有时候手动停止未提交的事务 导致的锁表
elect sess.sid,
sess.serial#,
lo.oracle_username,
lo.os_user_name,
ao.object_name,
lo.locked_mode
from v$locked_object lo, dba_objects ao, v$session sess
where ao.object_id = lo.object_id
and lo.session_id = sess.sid;
--杀掉会话
alter system kill session 'sid,serial#';
select username,serial#, sid from v$session; ---查询用户会话