DBMS_SCHEDULER.set_job_argument_value - ORA-27473:参数不存在

时间:2015-02-06 12:30:14

标签: oracle stored-procedures oracle11g job-scheduling dbms-job

您好我正在创建一个JOB CONTROLLER来运行一个程序。

JOB CONTROLLER程序'

CREATE OR REPLACE PROCEDURE "GCCPMAINT"."JOB_CONTROLLER" as
        programTotal number;    
BEGIN
        dbms_scheduler.create_program (
                   program_name           =>  'PGM_CLEANSE_BRNGB',
                   program_type           =>  'STORED_PROCEDURE',
                   program_action         =>  'OPT_SALES',
                   number_of_arguments => 1,
                   enabled            =>  FALSE);


        dbms_scheduler.DEFINE_PROGRAM_ARGUMENT(
                program_name=>'PGM_CLEANSE_BRNGB',
                argument_name=>'card_no',
                argument_position=>1,
                argument_type=>'varchar2');

        dbms_scheduler.enable('PGM_CLEANSE_BRNGB');

        DBMS_SCHEDULER.drop_job(job_name => 'JOB_Cleanse_BRNGB', force => true);
        dbms_scheduler.create_job('JOB_Cleanse_BRNGB',program_name=>'PGM_CLEANSE_BRNGB',auto_drop=> true,start_date=>SYSDATE,job_style=> 'LIGHTWEIGHT');

        dbms_scheduler.set_job_argument_value(
                               job_name=>'JOB_Cleanse_BRNGB',
                               argument_name=>'card_no',---> error says here
                               argument_value=>'1234');

        dbms_scheduler.enable('JOB_Cleanse_BRNGB');
END;

这是我的计划行动程序

CREATE OR REPLACE PROCEDURE "OPT_SALES"(card_no VARCHAR2)
as
BEGIN
DBMS_OUTPUT.PUT_LINE ('card-Number is'||card_no);
END;

当我尝试运行作业控制器程序时,它将错误称为

  

17:42:28 [@CALL - 0 row(s),0.000 secs] [错误代码:27473,SQL   状态:99999] ORA-27473:参数CARD_NO不存在ORA-06512:   at" SYS.DBMS_ISCHED",第244行ORA-06512:at" SYS.DBMS_SCHEDULER",   第716行ORA-06512:at" GCCPMAINT.JOB_CONTROLLER",第27行ORA-06512:   在第1行

我有正确的论据,那么为什么它说"论证CARD_NO不存在"

请有人帮帮我。

1 个答案:

答案 0 :(得分:1)

您也可以在不使用程序的情况下调用过程。请看一下这个。 (另外,默认情况下auto_drop为true)

DBMS_SCHEDULER.CREATE_JOB
(
   job_name        => 'JOB_Cleanse_BRNGB'
  ,job_class       => 'DEFAULT_JOB_CLASS'
  ,job_type        => 'STORED_PROCEDURE'
  ,start_date      =>  SYSDATE
  ,job_style       => 'LIGHTWEIGHT'
  ,job_action      => 'OPT_SALES'
  ,number_of_arguments   =>  1
);

dbms_scheduler.set_job_argument_value(
                           job_name=>'JOB_Cleanse_BRNGB',
                           argument_name=>'CARD_NO',---> error says here
                           argument_value=>'1234');
dbms_scheduler.enable('JOB_Cleanse_BRNGB');