CREATE_PROGRAM v18
Use the CREATE_PROGRAM procedure to create a DBMS_SCHEDULER program. The signature is:
CREATE_PROGRAM( <program_name> IN VARCHAR2, <program_type> IN VARCHAR2, <program_action> IN VARCHAR2, <number_of_arguments> IN PLS_INTEGER DEFAULT 0, <enabled> IN BOOLEAN DEFAULT FALSE, <comments> IN VARCHAR2 DEFAULT NULL)
Parameters
program_name
program_name specifies the name of the program that's being created.
program_type
program_type specifies the type of program. The current implementation of CREATE_PROGRAM supports a program_type of PLSQL_BLOCK or PROCEDURE.
program_action
If
program_typeisPLSQL_BLOCK, program_actioncontains the PL/SQL block that executes when the program is invoked. The PL/SQL block must be terminated with a semi-colon (;).If
program_typeisPROCEDURE,program_actioncontains the name of the stored procedure.
number_of_arguments
If
program_typeisPLSQL_BLOCK, this argument is ignored.If
program_typeisPROCEDURE,number_of_argumentsspecifies the number of arguments required by the procedure. The default value is0.
enabled
enabled specifies if the program is created enabled or disabled:
If
enabledisTRUE, the program is created enabled.If
enabledisFALSE, the program is created disabled. Use theDBMS_SCHEDULER.ENABLEprogram to enable a disabled program.The default value is
FALSE.
comments
Use the comments parameter to specify a comment about the program. By default, this parameter is NULL.
Example
The following call to the CREATE_PROGRAM procedure creates a program named update_log:
EXEC DBMS_SCHEDULER.CREATE_PROGRAM ( program_name => 'update_log', program_type => 'PLSQL_BLOCK', program_action => 'BEGIN INSERT INTO my_log VALUES(current_timestamp); END;', enabled => TRUE, comments => 'This program adds a row to the my_log table.');
update_log is a PL/SQL block that adds a row containing the current date and time to the my_log table. The program is enabled when the CREATE_PROGRAM procedure executes.
- On this page
- Parameters
- Example