본문 바로가기

Programming/Oracle

[Oracle] Job 삭제

Job을 삭제할 때 사용하는 프로시저

// 한 건만 삭제할 경우
declare
val NUMBER;
begin
    select job into var from user_jobs
    where what = '삭제할 프로시저명;'
        and rownum = 1;
    sys.dbms_job.remove(var);
end;

// 여러 건을 삭제할 경우
declare
cursor jb is
  select job from user_jobs
  where what = '삭제할 프로시저명;';     -- Job 번호를 조회
begin
  for tREC IN jb loop
    sys.dbms_job.remove( tREC.job );   -- remove(job번호)로 Job을 삭제
  end loop;
end;