數據庫用戶的表結構導出方法

create VIEW temp_VIEW as sql

(select b.column_name,a.table_name,b.column_id,b.data_type ide

from user_tables a,user_tab_columns b where a.table_name=b.TABLE_NAME);it


------------------------------------------io

select * from temp_view order by table_name,column_id;table



------------------------------------------class

spool create_table.sql;select


select tt fromnio

(select 'create table ' tt,table_name,0.1 column_id from user_tables utab

union alldi

select table_name||'( ',table_name,0.2 column_id from user_tables u

union all

select column_name||' '||data_type||',',t.table_name,column_id from user_tables u,temp_view t where u.TABLE_NAME=t.table_name

union all

select ' );',table_name,999 column_id from user_tables u) temp

--where table_name<>'TEMP_TABLE'

order by table_name,column_id;


spool off;


SQL>@create_table.sql

相關文章
相關標籤/搜索