Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

PLS-00103: Encountered the symbol in DBMS_SCHEDULER

Calling the package inside the job gives an Error report –

ORA-06550: line 8, column 5:
PLS-00103: Encountered the symbol "
  );
end; : AUXSQLDBIND4: = SqlDevBind1Z_1; : AUXSQLDBIND3: = SqlDevBind1Z_2; : AUXSQLDBIND2: = SqlDevBind1Z_3; : AUXSQLDBIND1: = SqlDevBind "

Help call the packet with the passed variable work_date for a certain calculation for each day of the month.

Thanks in advance for your help!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

DBMS_SCHEDULER.create_job (
job_name => 'J_ACCOUNT_TURNOVER_F',
job_type => 'PLSQL_BLOCK',
start_date => SYSTIMESTAMP, enabled => TRUE,
job_action => 
'declare
start_date number;
end_date number;
work_date date;
begin
start_date := to_number(to_char(to_date('2018-01-01', 'yyyy-MM-dd'), 'j'));
end_date := to_number(to_char(to_date('2018-01-31', 'yyyy-MM-dd'), 'j'));
for cur_r in start_date..end_date loop
 work_date := to_char(to_date(cur_r, 'j'), 'yyyyMMdd');
 dma.fill_account_turnover_f.fill(work_date);
end loop;
end;'
);
end;

>Solution :

Wouldn’t it be simpler if you created a stored procedure and called it, instead of embedding that anonymous PL/SQL block into DBMS_SCHEDULER.CREATE_JOB call? Now you have to escape single quotes, i.e. use two consecutive ones every time. Something like this:

begin
DBMS_SCHEDULER.create_job (
job_name => 'J_ACCOUNT_TURNOVER_F',
job_type => 'PLSQL_BLOCK',
start_date => SYSTIMESTAMP, enabled => TRUE,
job_action => 
'declare
start_date number;
end_date number;
work_date date;
begin
start_date := to_number(to_char(to_date(''2018-01-01'', ''yyyy-MM-dd''), ''j''));
end_date := to_number(to_char(to_date(''2018-01-31'', ''yyyy-MM-dd''), ''j''));
for cur_r in start_date..end_date loop
 work_date := to_char(to_date(cur_r, ''j''), ''yyyyMMdd'');
 dma.fill_account_turnover_f.fill(work_date);
end loop;
end;'
);
end;
/
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading