[Oracle] 데이터 타입체크하기
SELECT a.TABLE_NAME, c.COMMENTS, a.COLUMN_NAME, b.COMMENTS, a.DATA_TYPE, a.DATA_LENGTH, a.NULLABLE FROM USER_TAB_COLUMNS a, USER_COL_COMMENTS b, USER_TAB_COMMENTS c, USER_TABLES d where 1=1 and a.TABLE_NAME = D.TABLE_NAME and a.TABLE_NAME=b.TABLE_NAME and b.TABLE_NAME=c.TABLE_NAME and a.COLUMN_NAME=b.COLUMN_NAME and a.TABLE_NAME =upper(:TABLENAME) order by a.TABLE_NAME, a.COLUMN_ID;
2021. 11. 4.
vo생성쿼리
select rpad('private ' ||decode(a.data_type,'NUMBER','int','String') ||' ' ||lower(substr(a.column_name,1,1)) ||substr(replace(initcap(a.column_name),'_',''),2) ||';',30) ||nvl2(b.comments,'/* '||b.comments||' */','') from user_tab_cols a, user_col_comments b where a.table_name=upper(:TB) and b.table_name=upper(:TB) and a.column_name=b.column_name;
2021. 11. 4.