【问题标题】:run a procedure in while loop在while循环中运行一个过程
【发布时间】:2018-09-06 19:04:51
【问题描述】:

我有这个存储过程:

begin
Sp_Racf_Test;
end;

我不想编辑此过程中的任何内容。
我想运行一个循环语句,它应该运行 proc Sp_Racf_Test 直到 表 tem_joins 中的列 RACF_ID 为空。我的意思是当表tem_joins的列RACF_ID中没有空值时,运行存储过程的循环应该停止。

请提出疑问

【问题讨论】:

  • 如果在表 tem_joins 中RACF_ID 的空值后面有记录怎么办。例如.. 1,2,,4

标签: sql loops plsql


【解决方案1】:

试试下面的一个:

declare
    v_count number := 1;
    begin
    while v_count > 0 loop
      Select count(*) into v_count from tem_joins
    where racf_id is null;
    if v_count > 0 then
      Sp_Racf_Test;
    else
      exit;
    end if;
    end loop;
    end;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-12-18
    • 2022-01-16
    • 2020-01-04
    • 2011-11-02
    • 1970-01-01
    相关资源
    最近更新 更多