qq_35253687 2016-06-14 03:09 采纳率: 0%
浏览 1227

plsql 动态sql问题如何实现取,看下图说明,求解,谢谢

图片说明
如何实现取filter_code中的值全部满足的时候,返回成功,失败的时候把所有条件插入一个新表的字段中,并且失败的时候要遍历一遍所有条件,找出那个条件不满足

成功时必须满足如下条件:
'case when user_status_id=1
and x_cust_count=1
and call_duration_nofree>10
and arrear_all_fee and (z_call_count>1 or bill_cust_count_last=1) and user_status_id=1
and x_cust_count=1 and arrear_all_fee and (z_call_count>1 or bill_cust_count_last=1) then '0' else '1' end

        求解决方法
  • 写回答

1条回答 默认 最新

  • little_how 2016-06-14 03:38
    关注

    mysql:
    create procedure p_drop_table_if_exist_v2(p_table_name varchar(20))
    begin
    declare v_table_name varchar(20);
    declare exit handler for not found begin end;
    select distinct table_name into v_table_name from information_schema.columns WHERE table_name = p_table_name;
    if length(v_table_name)>0 then
    set @sql=concat('drop table ', p_table_name);
    prepare dtb from @sql;
    execute dtb;
    deallocate prepare dtb;
    end if;

    end;
    //

    oracle:
    procedure p_drop_table_if_exist_v2(p_table_name in varchar2)
    is
    v_table_name varchar2(20);
    begin
    select table_name into v_table_name from user_tables where table_name=upper(p_table_name);

    if length(v_table_name)>0 then
    execute immediate 'drop table ' || p_table_name || ' purge';
    end if;

    exception
    when no_data_found then
    begin
    null;
    end;

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型