在行 2 上开始执行命令时出错:
declare
x int;
begin
SYS.DBMS_JOB.SUBMIT
(job => x,
what => 'SP_Exec_Reprot(2,2,0,sysdate-1,sysdate,select to_number(to_char(sysdate-1,'fmww')) from dual,select to_number(to_char(sysdate,'fmww')) from dual);',
next_date => sysdate,
interval => 'trunc(sysdate)+1+2/24',----定时每天早上两点执行存储过程
no_parse => FALSE
);
SYS.DBMS_OUTPUT.PUT_LINE('Job Number is:'||to_char(x));
commit;
end;
错误报告:
ORA-06550: 第 7 行, 第 88 列:
PLS-00103: 出现符号 "FMWW"在需要下列之一时:
) , * & = - + < / > at in
is mod remainder not rem <an exponent (**)> <> or != or ~= >=
<= <> and or like LIKE2_ LIKE4_ LIKEC_ between || multiset
member SUBMULTISET_
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
------解决方案--------------------
单引号括起来里面的单引号要用两个表示一个。。
what => 'SP_Exec_Reprot(2,2,0,sysdate-1,sysdate,select to_number(to_char(sysdate-1,''fmww'')) from dual,select to_number(to_char(sysdate,''fmww'')) from dual);',
------解决方案--------------------
select to_number(to_char(sysdate-1,''fmww'')) from dual是个sql,返回一个结果集
存储过程要的是一个数 to_number(to_char(sysdate-1,''fmww''))
就算你的存储过程要的是个SQL,也得写成 'select to_number(to_char(sysdate-1,''fmww'')) from dual'.