zoukankan      html  css  js  c++  java
  • plsql for循环里赋值出错PLS00363:,应该改成while循环

    create or replace procedure deleteBigData as
    2 date_length number;
    3 temp NUMBER(19, 0);
    4 Begin
    5 temp :=0;
    6 select count(*) into date_length from tbl_log;
    7 for temp in 1..date_length
    8 loop
    9 delete from tbl_log where rownum=temp;
    10 if temp=10000 then
    11 temp:=0;
    12 commit;
    13 end if;
    14 end loop;
    15 end;
    16 /

    Warning: Procedure created with compilation errors.

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    11/2 PL/SQL: Statement ignored
    11/2 PLS-00363: expression 'TEMP' cannot be used as an assignment
    target

    改正为while循环

    create or replace procedure deleteBigData is
    date_length number;
    temp NUMBER(19, 0);
    Begin
    temp:=1;
    select count(*) into date_length from tbl_log;
    while temp<date_length
    loop
    delete from tbl_log where rownum=temp;
    if temp=10000 then
    temp:=0;
    commit;
    end if;
    end loop;
    end;
    /

  • 相关阅读:
    ubuntu 16.04 安装 python selenium
    DNS 小问题
    Ubuntu下安装setuptools
    ubuntu16.04LTS更换阿里源
    Ubuntu下安装 Phantomjs
    root和user切换
    Navicat破解安装教程
    urllib2
    MySQL划重点-查询-聚合-分组
    vi编辑器
  • 原文地址:https://www.cnblogs.com/daojian/p/2684883.html
Copyright © 2011-2022 走看看