Random guy
Random guy

Reputation: 923

Compilation Error while creating jobs in oracle

I am learning jobs in oracle.I am new to this topic.So,I created a table to store sysdate.

create table offc.MYTEST(
CREATED_ON DATE
)

I created the procedure as:

CREATE OR REPLACE PROCEDURE offc.myproc AS
BEGIN
INSERT INTO MYTEST(CREATED_ON)
VALUES (sysdate);
commit;
END myproc;
/

I created the jobs as:

BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name = ‘My_job’,
job_type = ‘STORED_PROCEDURE’,
job_action = ‘MYPROC’,
start_date = sysdate,
repeat_interval = ‘FREQ=SECONDLY;INTERVAL=5',
end_date =’1/2/2020 9:53:05 PM’,
auto_drop = FALSE,
comments = ‘My new job’);
END;
/

I got error as:

Error at line 1
ORA-01756: quoted string not properly terminated

Also,I am getting error as:

enter image description here

I dont know but the red markers are also seen.What is the problem here?

Upvotes: 1

Views: 61

Answers (1)

Ankit Bajpai
Ankit Bajpai

Reputation: 13509

Ahh, I think i get it. It seems you have copied it from somewhere so your single quotes are not Oracle supported and they are being treated as unsupported characters. I have created it again after typing all single quotes again and converting all = to =>-

BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'My_job',
job_type => 'STORED_PROCEDURE',
job_action => 'MYPROC',
start_date => sysdate,
repeat_interval => 'FREQ=SECONDLY;INTERVAL=5',
end_date => '02-Jan-2020 09:53:05 PM',
auto_drop => FALSE,
comments => 'My new job');
END;
/

Here is the fiddle. Since I do not have the privilege to create job on fiddle, You are seeing that error there.

Upvotes: 1

Related Questions