zoukankan      html  css  js  c++  java
  • oracle数据库应用总结

    1------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>merge into 函数的使用

    MERGE INTO tb_yygl_xxplbbgl_log a  
            USING (  
                  SELECT COUNT(*) COUNT
                  FROM tb_yygl_xxplbbgl_log x
                  WHERE  x.fund_code=#{pd.p8,jdbcType=VARCHAR} and x.bb_qj=#{pd.p9,jdbcType=VARCHAR}
              ) b  
            ON (b.count>0)  
            WHEN MATCHED THEN  
                  UPDATE SET  a.beforstatus = '0',
                              a.afterstatus='1'
                  WHERE a.fund_code=#{pd.p8,jdbcType=VARCHAR} and a.bb_qj=#{pd.p9,jdbcType=VARCHAR}
            WHEN NOT MATCHED THEN  
                  insert (
                        ID,
                        REC_NAME,
                        CONTACT_WAY,
                        SEND_TYPE,
                        STATUS,
                        flag,
                        insert_time,
                        fund_code,
                        bb_qj,
                        bb_type,
                        <if test="pd.p11=='flagbefore'">
                          beforstatus,
                        </if>
                        <if test="pd.p11=='flagafter'">
                          afterstatus,
                        </if>
                        username
                        )
                        
                 values(to_char(systimestamp,'yyyyMMddhh24missff'),
                            #{pd.p2,jdbcType=VARCHAR},
                            #{pd.p3,jdbcType=VARCHAR},
                            '1',
                            '0',
                            'inner',
                             sysdate,
                            #{pd.p8,jdbcType=VARCHAR},
                            #{pd.p9,jdbcType=VARCHAR},
                            #{pd.p10,jdbcType=VARCHAR},
                            <if test="pd.p11=='flagbefore'">
                             '0',
                            </if>
                            <if test="pd.p11=='flagafter'">
                              '1',    
                            </if>
                            #{pd.userName}            
                         )      
    MERGE INTO T_EXPORT_RATE p 
                           USING (select #{pd.p2} exportrate,#{pd.p1} fund_code,#{pd.operatorRole} operatorRole,#{pd.userName}  userName from dual) np
                          ON (np.fund_code = p.fund_code)
                WHEN MATCHED THEN
                          UPDATE SET p.whetherexport='01',
                                              p.exportrate=np.exportrate,
                                                p.showdate='',
                                                p.update_date=sysdate,
                                                p.username=np.userName,
                                                p.operatorrole=np.operatorRole,
                                                p.if_holidays=''
                WHEN NOT MATCHED THEN
                         insert values (np.fund_code,'01',np.exportrate,'',sysdate,sysdate,np.userName,np.operatorRole,'') 
                

    decode 函数的使用

     decode(tyxl.beforstatus,'0','发送成功',' ') beforedxstatus,

    case when then else end 函数的应用

    case
    when (h.telephone is not null and h.email is not null) then
    '0'
    else
    '1'
    end isxpstatus

    --复制表的操作

      create table t_fund_infobak  as select * from t_fund_info;

  • 相关阅读:
    js正则验证邮箱格式
    PHP面向对象简易验证码类
    php 中 instanceof 操作符
    防止SQL注入
    通过实例详细讲解PHP垃圾回收机制
    PHP实现上传视频的功能
    二维数组分组
    时间戳转换为几分钟、几小时、几天、几周、几月、几年前
    自定义接口错误响应格式
    laravel写crontab定时任务(发送邮件)和laravel crontab不执行的问题
  • 原文地址:https://www.cnblogs.com/xiaofuzi123456/p/11211251.html
Copyright © 2011-2022 走看看