zoukankan      html  css  js  c++  java
  • Oracle某些功能实现语句处理方法

    触发器以及序列
    CREATE OR REPLACE TRIGGER t_MSTB_BDS_DATA BEFORE INSERT ON MSTB_BDS_DATA FOR EACH ROW DECLARE INTEGRITY_ERROR EXCEPTION; ERRNO INTEGER; ERRMSG CHAR(200); DUMMY INTEGER; FOUND BOOLEAN; BEGIN SELECT SEQ_MSTB_BDS_DATA.NEXTVAL INTO :NEW.data_id FROM DUAL; -- ERRORS HANDLING EXCEPTION WHEN INTEGRITY_ERROR THEN RAISE_APPLICATION_ERROR(ERRNO, ERRMSG); END ; create sequence SEQ_MSTB_BDS_DATA minvalue 1 maxvalue 9999999999999999999999999999 start with 1 increment by 1 cache 21;
    插入HTML格式语句实现方法
    
    某字段存数据为以下格式:<input type='radio'  name='ids'  value='$0'/>
    insert into MSTB_BDS_DATA (DATA_ID, NAME_TC ) values('16', '<input type='||'''radio''  name='||'''ids''  value='||'''$0''/>')
    
    格式为这样的<img src='afw/common/images/table/basic_blue/filter.gif'/>
    
    实现如下:
    insert into MSTB_BDS_DATA ( NAME_TC) values('<img src='||'''afw/common/images/table/basic_blue/filter.gif''/>');
    insert into MSTB_BDS_DATA ( NAME_TC) values('<textarea cols='||''''' rows='||'''''>);
    
    MySQL的级联更新:
    UPDATE BLC_DrawRcd tt1
                INNER JOIN BLC_DrawCash tt2  ON tt1.TradeSysWater = tt2.TradeSysWater
                SET tt1.YsBackToDjAcc = '12' ,tt1.YsBackDebit = p_tmp_water_str_hz 
                WHERE tt2.BalanceStatus = '09' 
                                    AND tt2.TradeStatus = 2
                                    AND tt1.DrawBanckAccountType <> '01'  
                                    AND tt1.YsResult = '9'
                                    AND    to_char(tt2.TradeTime,'yyyyMMdd') < p_tmp_now_day 
                                    AND tt2.Memo='01' AND  tt1.YsBackToDjAcc = '11'
    Oracle的级联更新:
     UPDATE BLC_DrawRcd tt1  SET tt1.YsBackToDjAcc = '12' ,tt1.YsBackDebit = p_tmp_water_str_hz 
                    where exists(select * from BLC_DrawCash tt2  where  tt1.TradeSysWater = tt2.TradeSysWater
                     AND tt2.TradeStatus = 2
                                    AND tt1.DrawBanckAccountType <> '01'  
                                    AND tt1.YsResult = '9'
                                    AND    to_char(tt2.TradeTime,'yyyyMMdd') < p_tmp_now_day 
                                    AND tt2.Memo='01' AND  tt1.YsBackToDjAcc = '11'  -- 待退款
                    );
    MySQL case 用法
    
    UPDATE  Meb_UserLogOff  tt1  
    							INNER JOIN BLC_DrawRcd tt2
    							ON tt1.UserLogOffId = tt2.QmLogOffID
    							AND  tt2.DrawToAccRspFile = pin_fName_Ret  AND tt2.DrawBanckAccountType ='01'  
    			SET LogOffStatus = CASE tt2.YsResult WHEN '0' THEN '10'
    

      

    oracle   case when 用法
    UPDATE  Meb_UserLogOff  tt1  
            SET LogOffStatus =( select CASE WHEN tt2.YsResult ='0' THEN '10'   END  from BLC_DrawRcd tt2
            where tt1.UserLogOffId = tt2.QmLogOffID
                                AND  tt2.DrawToAccRspFile = pin_fName_Ret  AND tt2.DrawBanckAccountType ='01')
             where exists(select 1 from BLC_DrawRcd tt2  where  tt1.UserLogOffId = tt2.QmLogOffID
             AND  tt2.DrawToAccRspFile = pin_fName_Ret  AND tt2.DrawBanckAccountType ='01' );
  • 相关阅读:
    python机器学习基础教程-鸢尾花分类
    LaTeX实战经验:如何写算法
    Latex公式最好的资料
    BibTex (.bib) 文件的注释
    Latex中参考文献排序
    LATEX双栏最后一页如何平衡两栏内容
    Latex强制图片位置
    Endnote输出Bibtex格式
    redis学习
    20180717
  • 原文地址:https://www.cnblogs.com/Warmsunshine/p/4523452.html
Copyright © 2011-2022 走看看