【发布时间】:2018-10-08 06:47:47
【问题描述】:
我知道我可以很容易地用create table t1 select * from table2;创建一个表的副本但是我需要复制:
- 列
- cmets
- 表空间
- 索引
- 赠款
- 触发器
- 键
- 默认值
- ...
- 任何其他依赖项
有没有办法通过pl/sql 程序来做到这一点?我的 Oracle 版本是 11R2。
表的SQL:
-- Create table
create table SCHEMA.MY_TABLE
(
id number(1),
name varchar2(30),
dat date
)
tablespace MY_TS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 10M
next 1M
minextents 1
maxextents unlimited
);
-- Add comments to the table
comment on table SCHEMA.MY_TABLE
is 'MY TABLE';
comment on column SCHEMA.MY_TABLE.ID
is 'id';
comment on column SCHEMA.MY_TABLE.NAME
is 'name of operation';
comment on column SCHEMA.MY_TABLE.DAT
is 'date of operation';
grant select on SCHEMA.MY_TABLE to PUBLIC;
【问题讨论】: