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 ;
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/tech/database/244537.html