0

嗨,我正在创建一个 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 行,0.000 秒] [错误代码:27473,SQL 状态:99999] ORA-27473:参数 CARD_NO 不存在 ORA-06512:在“SYS.DBMS_ISCHED”行244 ORA-06512:在“SYS.DBMS_SCHEDULER”,第 716 行 ORA-06512:在“GCCPMAINT.JOB_CONTROLLER”,第 27 行 ORA-06512:在第 1 行

我有正确的论点,那么为什么它说“参数 CARD_NO 不存在”

任何人都可以帮助我吗?

4

1 回答 1

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');
于 2015-02-06T13:40:11.787 回答