ORACLE下删除当前用户下所有对象的SQL
ORACLE下删除当前用户下所有对象的SQL
Sql代码
--删除某个用户下的对象
set heading off;
set feedback off;
spool c:\dropobj.sql;
prompt --Drop constraint
select 'alter table '||table_name||' drop constraint '||constraint_name||' ;' from user_constraints where constraint_type='R';
prompt --Drop tables
select 'drop table '||table_name ||';' from user_tables;
prompt --Drop view
select 'drop view ' ||view_name||';' from user_views;
prompt --Drop sequence
select 'drop sequence ' ||sequence_name||';' from user_sequences;
prompt --Drop function
select 'drop function ' ||object_name||';' from user_objects where object_type='FUNCTION';
prompt --Drop procedure
select 'drop procedure '||object_name||';' from user_objects where object_type='PROCEDURE';
prompt --Drop package
prompt --Drop package body
select 'drop package '|| object_name||';' from user_objects where object_type='PACKAGE';
prompt --Drop database link
select 'drop database link '|| object_name||';' from user_objects where object_type='DATABASE LINK'; &
相关文档:
冷拷备了一个原有数据库,要把他移植到新的数据库中时,要注意一下:
1.Oradim -new -sid [实例名:demo] -intpwd [PWD] -pfile= [要创建实例的配置文件:*.ora]
2.set Oracle_SID=[实例名](装完后记得要在注册表里加上:HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb10g_home1:ORACLE_SID,值为实例名。)
3.sql ......
单表插入以insert into开头,不能有then into语句.
多表插入以insert first/all 开头,可以有then into语句
在Oracle操作过程中经常会遇到同时向多个不同的表插入数据,此时用该语句就非常合适。
All表示非短路运算,即满足了第一个条件也得向下执行查看是否满足其它条件,而First是短路运算找到合适条件就不向下进行。
I ......
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......
oracle让id自动增长(insert时不用手动插入id)的办法,像Mysql中的auto_increment那样
创建序列
create sequence emp_seq
increment by 1
start with 1
nomaxvalue
nocycle
......
测试table
create table table1 (id int,name char)
insert into table1
select 1,'q'
union all select 2,'r'
union all select 3,'3'
union all select 4,'5'
要求按指定的id顺序(比如2,1,4,3)排列获取table1的数据
方法1:使用union all,但是有256条数据的限制
select id,name from table1 where id=2
union al ......