在Plsql中写了一个存储过程,并且测试通过,如下:
CREATE OR REPLACE PROCEDURE P_NEW_JINGQU_VISIT_GY_H(p_day STRING, p_hour STRING) --定义参数 ASv_day VARCHAR2(255);v_hour VARCHAR2(255); --定义变量
BEGIN--用输入参数给变量赋值SELECT MAX(clndr_dt) INTO v_day FROM NEW_JINGQU_VISIT_GY_H WHERE clndr_dt <= p_day;SELECT MAX(hour_id) INTO v_hour FROM NEW_JINGQU_VISIT_GY_H WHERE clndr_dt = v_day AND hour_id <= p_hour; --可以使用变量进行限制?DELETE FROM NEW_JINGQU_VISIT_GYWHERE clndr_dt = p_dayAND hour_id = p_hour;insert into pro_logselect 'P_HX_JS_CASE_INFO',sysdate from dual;COMMIT;
END;
然后添加Job运行报错:
原因市在what值配置有问题,没有传入参数
what值应该采用如下的写法:
declarev1 int;V2 VARCHAR2(2);beginv1 :=TO_CHAR (SYSDATE , 'yyyymmdd');V2 :=TO_CHAR(SYSDATE-1/24,'HH24');P_NEW_JINGQU_VISIT_GY_H(v1,V2);end;
问题解决