0

I am trying to create a simple scheduled event in an oracle 10g database. I have been trying to use dbms_scheduler.create_job. Here is the script I wrote:

begin dbms_scheduler.create_job (

job_name => 'disengagementChecker',

job_type => 'PLSQL_BLOCK',

job_action => 'INSERT INTO PatientClassRelObs(patientClassID,observationTypeID) VALUES (1, 11)',

start_date => SYSDATE,

repeat_interval => 'FREQ=MINUTELY;INTERVAL=1',

comments => 'Iam tesing scheduler'); end;

When I run this, oracle throws these errors

ORA-06550: line 15, column 3:

PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

; The symbol ";" was substituted for "end-of-file" to continue.

I don't understand whats causes this error. Do you know what causes this error? Or why this is happening?

Thank you in advance!

-David

user3412162
  • 283
  • 1
  • 4
  • 6

1 Answers1

0

JOB_ACTION must be a valid PL/SQL block, not just a valid SQL statement. Use this:

job_action => '
  BEGIN
    INSERT INTO PatientClassRelObs(patientClassID,observationTypeID)
    VALUES (1, 11);
  END;',

UPDATE

Maybe this is a problem with a specific environment or some code not posted. To troubleshoot, start with something that's known to work, and add one small change at a time until something breaks.

Start with this code, using SQL*Plus.

SQL> begin
  2     dbms_scheduler.create_job(
  3             job_name   => 'TEST_JOB',
  4             job_type   => 'PLSQL_BLOCK',
  5             job_action => 'BEGIN NULL; END;',
  6             start_date => systimestamp,
  7             enabled    => true);
  8  end;
  9  /

PL/SQL procedure successfully completed.

SQL> select status, log_date from dba_scheduler_job_run_details where job_name = 'TEST_JOB';

STATUS                         LOG_DATE
------------------------------ ---------------------------------------------------------------------------
SUCCEEDED                      26-MAR-14 11.37.59.533000 PM -05:00
Jon Heller
  • 34,999
  • 6
  • 74
  • 132
  • thank you for your help, but I am still getting the same errors as before. By any chance, do I need to any import or set-up before I can use dbms_scheduler.create_job? (Im new to oracle) – user3412162 Mar 27 '14 at 04:19