sql:
--APPLICANT為表名select 'private ' || decode(a.DATA_TYPE, 'VARCHAR2', 'String ', 'NUMBER', 'Double ', 'String ') || lower(a.column_name) || '; //' || b.comments from user_tab_cols a,user_col_comments b where a.TABLE_NAME = b.TABLE_NAME and a.COLUMN_NAME = b.COLUMN_NAME and a.table_name = 'APPLICANT' --大寫;
資料:
private String residence; //戶籍private String high; //身高private String weight; //體重private String drivinglicenceno; //駕駛執照private String issmoking; //是否抽煙private String dismissdate; //離職日期private String deathdate; //死亡日期private String contactphone; //聯絡電話private String urgencycontactphone; //緊急聯絡電話private String contactmobile; //聯絡手機private String contactfax; //連絡人傳真private String contactemail; //連絡人電子郵件地址
表名得到表的欄位個數
select a.tname, count(*) field_count from tab a, user_col_comments b where tabtype = 'TABLE' and a.tname = b.table_name --and tname='USEINFO' 表名 group by a.tname