• jpa 表字段转bean对象


    select 'private ' || decode(v_type, 'int', 'Integer', 'float', 'Double', 'date', 'Date', 'String') || ' ' || v_name || ';' from
    (
    select column_id, column_name,
    case when instr(v_name, '_') > 0 then substr(v_name, 1, instr(v_name, '_') - 1) || upper(substr(v_name, instr(v_name, '_') + 1, 1)) || lower(substr(v_name, instr(v_name, '_') + 2)) else v_name end v_name, v_type
    from
    (
    select column_id, column_name, (case length(substr(column_name, 1, instr(column_name, '_') - 1)) when 1 then substr(column_name, 1, 1) else
    lower(substr(column_name, 1, instr(column_name, '_') - 1)) end) || substr(column_name, instr(column_name, '_') + 1, 1) || lower(substr(column_name, instr(column_name, '_') + 2)) v_name,
    (case when data_type = 'NUMBER' and data_scale > 0 then 'float' else (case data_type when 'NUMBER' then 'int' when 'DATE' then 'date' else 'string' end) end) v_type
    from user_tab_columns where table_name = 'MZGL_BRSFMX' --order by column_id
    ) --order by column_id
    ) order by column_id;

    declare
    r_return varchar2(200);
    v_sql varchar2(1000);
    CURSOR C_AGE IS SELECT column_name FROM all_tab_columns where table_name='MZGL_BRSFMX' order by column_id;

    begin
    v_sql:='';
    FOR R_DT IN C_AGE LOOP

    r_return:= (case length(substr(R_DT.column_name, 1, instr(R_DT.column_name, '_') - 1)) when 1 then substr(R_DT.column_name, 1, 1) else
    lower(substr(R_DT.column_name, 1, instr(R_DT.column_name, '_') - 1)) end) || substr(R_DT.column_name, instr(R_DT.column_name, '_') + 1, 1) || lower(substr(R_DT.column_name, instr(R_DT.column_name, '_') + 2)) ;
    --r_return:= R_DT.column_name;
    v_sql:=v_sql||',"'||r_return||'"';
    END LOOP;
    dbms_output.put_line(v_sql);
    end;

  • 相关阅读:
    Spark概述及集群部署
    Scala编程实战
    Scala的高级特性
    Scala基础
    MapReduce优化参数
    HDFS安全模式
    HDFS元数据管理机制
    Hadoop Federation联邦
    Hadoop HA集群的搭建
    Hadoop High Availability高可用
  • 原文地址:https://www.cnblogs.com/doudou618/p/5902564.html
Copyright © 2020-2023  润新知