Re: Copy table attributes
Date: Thu, 21 Jul 1994 22:05:48 GMT
Message-ID: <sivar.13.0011194C_at_gscrb.sandiegoca.ncr.com>
In article <3045f2$n7l_at_Tut.MsState.Edu> msbaer_at_mars.NoSubdomain.NoDomain (Michael Baer) writes:
>From: msbaer_at_mars.NoSubdomain.NoDomain (Michael Baer)
>Subject: Copy table attributes
>Date: 14 Jul 1994 19:59:30 GMT
>I am using oracle 7.0.15.4 in a application. I previously used empress
>database.
>In empress we gave the command "empsqlcmd database_name dump tmp_file" on the
>command line and it would create a file that showed the columns of the table, we
>could then issue the command "empsqlcmd database_name create new_table_name from
>tmp_file". These commands in a shell script called from a larger application
>would create a new table that has all the same columns and constraints as the
>old table.
>In Oracle the import/export functions would create a table with the same name,
>or in this case bomb because I am trying to overwrite the old table. Does
>anyone have any suggestions.
>Thanks in advance.
>Mike
>msbaer_at_cast.msstate.edu
Try :
Create table new_table as select * from old_table;
This will create the new table AND copy all rows across.
If you do not want to copy the rows, but only create the table definition:
create table new_table as select * from old_table where rownum > 1;
If you want to copy across users, qualify old_table as user_name.old_table
after granting select on old_table to new_user.
Siva
Received on Fri Jul 22 1994 - 00:05:48 CEST