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 github符合条件20分钟秒到账,github空投 提供github账号可兑换💰感兴趣的可以找我交流一下
  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?