• etl 获取列数据类型


    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;

  • 相关阅读:
    发卡构型高分子的跨膜传输
    《一个数学家的叹息》读后
    匀速拉地毯最少需要多大的力
    桥环形高分子的标度理论——链滴图像
    试验1
    自定义控件EditText
    自定义控件TextView
    HTTP的应用httpclient 和线程
    http的应用httpurlconnection--------1
    学习笔记—Fragement +Actionbar
  • 原文地址:https://www.cnblogs.com/kexb/p/5100566.html
Copyright © 2020-2023  润新知