oracle获取表结构

select t.COLUMN_NAME,
Decode(t.DATA_TYPE,'NUMBER',DATA_TYPE||'('||DATA_LENGTH||','||DATA_PRECISION||')',DATA_TYPE||'('||DATA_LENGTH||')') DATA_TYPE,
t.NULLABLE,
t.COLUMN_ID,
c.COMMENTS
from user_tab_columns t, user_col_comments c
where t.table_name = c.table_name
and t.column_name = c.column_name
and t.table_name = 'MENZSF'
order by t.COLUMN_ID ;



select 'alter table MENZSF add ('|| t.COLUMN_NAME||' ' ||
Decode(t.DATA_TYPE,'NUMBER',DATA_TYPE||'('||DATA_LENGTH||','||DATA_PRECISION||')',DATA_TYPE||'('||DATA_LENGTH||')') ||');',
t.NULLABLE,
t.COLUMN_ID,
c.COMMENTS
from user_tab_columns t, user_col_comments c
where t.table_name = c.table_name
and t.column_name = c.column_name
and t.table_name = 'MENZSF'
order by t.COLUMN_ID ;

posted @ 2022-04-10 10:48  绿水青山777  阅读(298)  评论(0编辑  收藏  举报