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 ;