Вопрос

I have a job that should execute stored procedure. The procedure has date parameter. The hours/minutes are important. However after I set the argument value like this:

dbms_scheduler.set_job_argument_value(job_name =>  jobName, argument_position => 1, argument_value => deadline);

inside the procedure the parameter contains date only (with 0 hours, 0 minutes, 0 seconds). After some googling I figured it must be because argument_value expects varchar so I tried passing the value like this:

  dbms_scheduler.set_job_argument_value(job_name =>  jobName, argument_position => 1, argument_value => TO_CHAR(deadline, 'MM/DD/YYYY HH24:MI:SS'));

but now it looks like the procedure doesn't run at all. What is the correct way to pass date into job without losing hours and minutes?

Это было полезно?

Решение

Should've googled a little more before asking here... Turns out there's another procedure for non-varchar arguments:

    dbms_scheduler.set_job_anydata_value(job_name =>  jobName, argument_position => 1, argument_value => sys.anyData.convertDate(deadline));

This way everytinh works fine.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top