QueryInfo info = new QueryInfo();
info.CustomSQL = @" select
column_name,
data_type,
data_precision,
data_scale,
nvl((select t_s.comments
from all_col_comments t_s
where t_s.column_name = t.column_name
and t_s.table_name ='ccr_company_fundamental'
),column_name)
comments
from all_tab_columns t
where
table_name = upper('ccr_company_fundamental')
and data_type='NUMBER'";
DataTable table1 = Dao.ExcuteDataSet(info).Tables[0];
StringBuilder sb1 = new StringBuilder();
string type = "";
int scale = 0;
string real_type = "";
int index = 0;
string column_name = "";
foreach (DataRow row in table1.Rows)
{
column_name = row["COLUMN_NAME"].ToString();
type = row["DATA_TYPE"].ToString();
int.TryParse(row["data_scale"].ToString(), out scale);
switch (type)
{
case "NUMBER":
if (scale <= 0)
sb1.AppendLine(string.Format("new Excel2DataMap {{ MapIndex ={0}, ColumnName = '{1}', DataType = ConstEnum.DataTypeDimesion.整形 }},", index++, column_name));
else
{
sb1.AppendLine(string.Format("(new Excel2DataMap {{ MapIndex ={0}, ColumnName = "{1}", DataType = ConstEnum.DataTypeDimesion.浮点型 }}),", index++, column_name));
}
break;
case "NVARCHAR2":
case "VARCHAR2":
sb1.AppendLine(string.Format("(new Excel2DataMap {{ MapIndex ={0}, ColumnName = "{1}", DataType = ConstEnum.DataTypeDimesion.字符串 }}),", index++, column_name));
break;
case "DATE":
sb1.AppendLine(string.Format("(new Excel2DataMap {{ MapIndex ={0}, ColumnName = "{1}", DataType = ConstEnum.DataTypeDimesion.日期 }}),", index++, column_name));
break;
}
}
return;