Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Scheduling a job for a procedure with parameter

Rajan SwOct 11 2022

Hi,
I have a procedure PR_DROP_PART which accepts one param as below
ROCEDURE Pr_Drop_Part(P_Ret_Days NUMBER).

When I am creating and scheduling a job for this with params it is erroring out like

BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'drop_partitions',
job_type => 'STORED_PROCEDURE',
job_action => 'BEGIN NGAEAMADM.PR_DROP_PART(30); END;',
start_date => '11-OCT-22 11.00.00 PM Canada/Saskatchewan',
repeat_interval => 'FREQ=DAILY;', /* every other day */
end_date => '11-OCT-23 11.00.00 PM Canada/Saskatchewan',
auto_drop => FALSE,
comments => 'This job is to drop the 30 days old partitions');
END;
/
Error is :
ORA-27452: "BEGIN NGAEAMADM.PR_DROP_PART(30); END;" is an invalid name for a database object.
ORA-06512: at "SYS.DBMS_ISCHED", line 175
ORA-06512: at "SYS.DBMS_SCHEDULER", line 286
ORA-06512: at line 2
27452. 00000 - "\"%s\" is an invalid name for a database object."
*Cause: An invalid name was used to identify a database object.
*Action: Reissue the command using a valid name.

However if I create with out any params like below it is all fine

BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'drop_partitions',
job_type => 'STORED_PROCEDURE',
job_action => 'PR_DROP_PART',
start_date => '11-OCT-22 11.00.00 PM Canada/Saskatchewan',
repeat_interval => 'FREQ=DAILY;', /* every other day */
end_date => '11-OCT-23 11.00.00 PM Canada/Saskatchewan',
auto_drop => FALSE,
comments => 'This job is to drop the 30 days old partitions');
END;
/

could you please help me with the correct syntax or any references

Thanks in advance
Using oracle 19C

This post has been answered by asahide on Oct 11 2022
Jump to Answer
Comments
Post Details
Added on Oct 11 2022
3 comments
3,259 views