• 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
  • 相关阅读:
    HDOJ 1093
    HDOJ 1089
    HDOJ 1094
    qsort函数
    HDOJ 1092
    HDOJ 1091
    NYOJ 448(贪心)
    HDOJ 1090
    HDOJ 1097(幂取模)
    winform用户输入查询与拼音首字母的结合,提高用户的操作体验
  • 原文地址:https://www.cnblogs.com/love201314/p/14249938.html
Copyright © 2020-2023  润新知