--drop table table2;
create table table1 (
x number(10, 2) default 10,
y varchar2(200) default 'NA'
);
create table table2 as select * from table1;
Let us try for data_default:
create table search_user_tab_columns as
select table_name, column_name, to_lob(DATA_DEFAULT) dd
from user_tab_columns
where table_name = 'TABLE1';
As data_default is a long data in user_tab_columns we have to create an intermediate
search_user_tab_columns (dummy) :-(
select 'ALTER TABLE "' || table_name || '" MODIFY "' || column_name || '" DEFAULT ' || Dd || ';'
from search_user_tab_columns
where table_name = 'TABLE1';
Note:
SELECT DBMS_METADATA.GET_DDL('TABLE','<TABLE_NAME>','<SCHEMA_NAME>') from dual;
This is better way of doing this if creating a table from an existing table . But sometimes you may try this for specific purposes.