Sqlserver2005迁移至Oracle系列之一:生成表(上)
2009-03-03 13:11:25 来源:WEB开发网--创建用户
if @isuser = 1
begin
if @onlydeltbs = 1
insert into ##table(ident,ctext) select 1,'--删除用户[' + @user + ']'
else
insert into ##table(ident,ctext) select 1,'--创建用户[' + @user + ']'
insert into ##table(ident,ctext) select 1,'DECLARE'
insert into ##table(ident,ctext) select 2,'DMSQL VARCHAR2(512):='''';'
insert into ##table(ident,ctext) select 2,'EXIST INT:=0;'
insert into ##table(ident,ctext) select 1,'BEGIN'
insert into ##table(ident,ctext) select 2,'SELECT COUNT(1) INTO EXIST FROM Dba_Users WHERE username = upper(''' + @user + ''');'
if @onlydeltbs = 1
begin
insert into ##table(ident,ctext) select 2,'IF EXIST = 1 THEN'
insert into ##table(ident,ctext) select 3,'DMSQL := ''DROP USER ' + @user + ' CASCADE'';'
insert into ##table(ident,ctext) select 3,'EXECUTE IMMEDIATE DMSQL;'
end
else
begin
insert into ##table(ident,ctext) select 2,'IF EXIST = 0 THEN'
insert into ##table(ident,ctext) select 3,'DMSQL := ''CREATE USER ' + @user + ' IDENTIFIED BY ' + @user + ''';'
insert into ##table(ident,ctext) select 3,'EXECUTE IMMEDIATE DMSQL;'
insert into ##table(ident,ctext) select 3,'DMSQL := ''GRANT DBA,UNLIMITED TABLESPACE TO ' + @user + ''';'
insert into ##table(ident,ctext) select 3,'EXECUTE IMMEDIATE DMSQL;'
end
insert into ##table(ident,ctext) select 2,'END IF;'
insert into ##table(ident,ctext) select 1,'END;'
insert into ##table(ident,ctext) select 1,''
end
if (@istable = 0) and (@issynonym = 0) and (@isindex = 0) and (@issequence = 0)
set @istable = @istable
else
begin
begin
- ››oracle 中 UPDATE nowait 的使用方法
- ››Oracle ORA-12560解决方法
- ››Oracle 10g RAC 常用维护命令
- ››Oracle如何在ASM中定位文件的分布
- ››sqlserver安装和简单的使用
- ››Oracle的DBMS_RANDOM.STRING 的用法
- ››oracle 外部表导入时间日期类型数据,多字段导入
- ››Oracle中查找重复记录
- ››oracle修改用户登录密码
- ››Oracle创建删除用户、角色、表空间、导入导出等命...
- ››Oracle中登陆时报ORA-28000: the account is lock...
- ››Oracle数据库在配置文件中更改最大连接数
更多精彩
赞助商链接