每月最后一天执行的job写法:
variable n number;
begin
dbms_job.submit(:n,'PR_SALES_GET_ORDER_REMAIN;',to_date('2010-09-30 23:50:00','yyyy-mm-dd hh24:mi:ss'),
'Sysdate + extract(Day from LAST_DAY(add_months(Sysdate,1)) )');
commit;
end;
/
SQL> select extract(Day from sysdate) from dual;
EXTRACT(DAYFROMSYSDATE)
-----------------------
27
SQL> select extract(year from sysdate) from dual;
EXTRACT(YEARFROMSYSDATE)
------------------------
2010
SQL> select extract(month from sysdate) from dual;
EXTRACT(MONTHFROMSYSDATE)
-------------------------
9
SQL> select sysdate from dual;
SYSDATE
-----------
2010-9-27 1
SQL>