这个,除了直接照抄一遍创建语句以外,有没有什么更简便的方法?谢了~

解决方案 »

  1.   

    create table newtb as select * from oldtb where 1<>1
      

  2.   


    --只是建立ta表,与emp表结构相同,并不添加数据
    create table ta as
    select * from scott.emp
    where 1=0;
    --建立tb表,结构与dept结构相同,将dept表中的数据导入其中:
    create table tb as
    select * from scott.dept
    where 1=1;
      

  3.   

    还要字段注释?oracle情何以堪。
      

  4.   


    --create table t_name as select * from another_table where 1=0
    --这种构造与现存表相同结构的表,是不会将comment带过来的,
    --下面是一个实例:
    create table student(
           stu_no number(5),
           stu_name varchar2(20),
           sex char(1) default 'M',
           age number(3))
    --
    comment on table student is '学生信息表';
    comment on column student.stu_no is '学生学号';
    comment on column student.stu_name is '学生姓名';
    comment on column student.sex is '性别';
    comment on column student.age is '学生年龄';
    SQL> desc student;
    Name     Type         Nullable Default Comments 
    -------- ------------ -------- ------- -------- 
    STU_NO   NUMBER(5)    Y                学生学号 
    STU_NAME VARCHAR2(20) Y                学生姓名 
    SEX      CHAR(1)      Y        'M'     性别     
    AGE      NUMBER(3)    Y                学生年龄 SQL> 
    SQL> create table t_stu as
      2  select * from student
      3  where 1=0;Table createdSQL> desc t_stu;
    Name     Type         Nullable Default Comments 
    -------- ------------ -------- ------- -------- 
    STU_NO   NUMBER(5)    Y                         
    STU_NAME VARCHAR2(20) Y                         
    SEX      CHAR(1)      Y                         
    AGE      NUMBER(3)    Y
    oracle comment