• delete/update/insert by join


    //delete
    delete from table1 a 
          where exists (select 1 
                          from table2 b 
                         where a.col1 = b.col1)
                         
    //insert 
    insert into table1 (
           col1,
           col2
    )select
           'a',
           'b'
      from dual
     where not exists (select 1
                         from table2
                        where index = ?)

     

     

    //update

      update /*+ bypass_ujvc */
             (select col1
                      from table1 a,
                             table2 b
                     where a.seq = b.seq
                       and a.code = '100000002972' )
               set col1 = '100'

    PS:/*+ bypass_ujvc */ 这个Hint 的意思是,两个表的关系是1:1

  • 相关阅读:
    回发保留前台添加的html
    关于NBear数据访问层IDData
    使用js把数字转化成会计格式
    二次注入
    .htaccess利用与Bypass方式总结
    HTTPoxy漏洞(CVE-2016-5385)
    JAVA并行程序基础一
    队列-数组实现
    Vuex
    稀疏数组
  • 原文地址:https://www.cnblogs.com/kevinkim/p/2343946.html
Copyright © 2020-2023  润新知