Oracle Cursors
Created 11 January 2006 00:00
  PROCEDURE my_proc IS
    CURSOR mytable_cur IS
      SELECT id
      FROM   mytable
      WHERE  status = 1;
  
  BEGIN
  
    FOR mytable_rec IN mytable_cur LOOP
      -- do whatever
    END LOOP;
  
  END my_proc;
Oracle : Checking for running jobs
Created 19 January 2006 00:00
You can see if a job is running in Oracle by checking against the user_jobs table for the exact name of what you are running, for example:

  SELECT COUNT(uj.job)
  INTO   v_running
  FROM   user_jobs uj
  WHERE  uj.what = 'myschema.mypackage.myproc;';