Tuesday, May 31st, 2011

Creating jobs in Toad for Oracle

1. Login to the database using Toad, and create a job as follows

 

2. Specify first Execution and subsequent executions as follows and type the SQL in “What to execute text box”

 

3. Following is the PL/SQL for job scheduler to execute the SQL command once on the first of each month

 

4. Following is the SQL which was scheduled

 

 

 

 

 

5. Complete code

DECLARE

X NUMBER;

BEGIN

SYS.DBMS_JOB.SUBMIT

(

job => X

,what => ‘delete from table_name

where date_column <= to_date(”” 01-01-2009 ””,””dd-mm-yyyy””);’

,next_date => to_date(’09/09/2009 00:14:10′,’mm/dd/yyyy hh24:mi:ss’)

,interval => ‘TRUNC(LAST_DAY(SYSDATE)) + 1′

,no_parse => FALSE

);

:JobNumber := to_char(X);

END;

 Viewed 911 times by 476 visitors


Category: Technical
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response

May 31, 2011
hillbillyToad

If you are on 10g or 11g, may I recommend you move from DBMS_JOB to DBMS_SCHEDULER? Toad supports both. Eventually Oracle will deprecate DBMS_JOB.

[Reply to this comment]