ITPub博客

首页 > Linux操作系统 > Linux操作系统 > DDL的“事务”操作

DDL的“事务”操作

原创 Linux操作系统 作者:jingcui3210 时间:2009-09-14 21:39:31 0 删除 编辑

今天看oracle administrator's guide,无意发现原来可以批量执行create table,create view,grant这三种语句,绑定到一块执行,要么全成功,要么全失败。

语法如下:
create schema authorization "schema_name"
create table ...
create view ...
grant ...;

例:
SQL> create schema authorization jcr
  2  create table tt(id number(3))
  3  create table ttt(id number(4))
  4  grant select on tt to hr;
 
Schema created
 
SQL> select table_name from user_tables;
 
TABLE_NAME
------------------------------
TTT
TT
T1
 
SQL> desc t1
Name       Type          Nullable Default Comments
---------- ------------- -------- ------- --------
ID         NUMBER(5)     Y                        
NAME       VARCHAR2(100) Y                        
CREATEDATE DATE          Y                        
 
SQL> create schema authorization edu
  2  create table tttt(id number(5))
  3  create table t1(id number(1));
 
create schema authorization jcr
create table tttt(id number(5))
create table t1(id number(1))
 
ORA-02425: 创建表失败
ORA-00955: 名称已由现有对象使用
 
SQL> select table_name from user_tables;
 
TABLE_NAME
------------------------------
TTT
TT
T1

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/13890753/viewspace-614639/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 学习cluster table
请登录后发表评论 登录
全部评论

注册时间:2008-07-20

  • 博文量
    14
  • 访问量
    24677