zoukankan      html  css  js  c++  java
  • oracle 批量修改数据

    T_SQL批量更新语句

    --更新tab1 col1和更新时间,共?set serveroutput on;
    declare
      execCnt NUMBER := 0;
      cursor cur_cdr is
       select id from tab1 where PLATFORM = 'Amazon' AND col1 IS NULL;
       type type_tab1_id is table of tab1.id%type;
       table_tab1_id type_tab1_id;
    
       ln_cnt number := 0;
      
    begin
      open cur_cdr;
      loop
        fetch cur_cdr bulk collect
          into table_tab1_id limit 1000;
      
        ln_cnt := ln_cnt + table_tab1_id.count;
        execCnt:= execCnt+ ln_cnt;
        dbms_output.put_line('执行结果: number:' || execCnt);
        -- forall i in 1 .. table_rowid.count
        For i In 1 .. table_tab1_id.Count loop
            update  tab1  set col1 = 0,UPDATE_DATETIME=sysdate where id=table_tab1_id(i);
            ln_cnt := ln_cnt - 1;
        end loop;
        commit;
        
        exit when cur_cdr%notfound or cur_cdr%notfound is null;
      end loop;
      close cur_cdr;
      commit;
    end;
    View Code
  • 相关阅读:
    Python学习资料
    异常
    I/O
    Python3+迭代器与生成器
    python标准数据类型
    人工智能、机器学习和深度学习
    原地排序和复制排序
    序列化和Json
    登陆加密小程序
    hashlib模块加密用法
  • 原文地址:https://www.cnblogs.com/love201314/p/14249938.html
Copyright © 2011-2022 走看看