The CREATE_PROGRAM procedure is used to create a program.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only MySQL mode.
Syntax
DBMS_SCHEDULER.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
| Parameter | Description |
|---|---|
| program_name | The name of the program. This name must be unique in the SQL namespace. For example, a program cannot have the same name as a table in the schema. If you do not specify a name, an error will occur. |
| program_type | The type of the program to be created. If you do not specify this parameter, an error will occur. Currently, only 'STORED_PROCEDURE' is supported, which specifies whether the program is a PL/SQL or Java stored procedure, or an external C subprogram. This parameter does not support functions with return values, or PL/SQL procedures with INOUT or OUT parameters. |
| program_action | The action of the program. If you do not specify program_action, an error will occur. For stored procedures, program_action is the name of the stored procedure. If the procedure is in a schema other than the job schema, you must specify the schema. If you need to distinguish between uppercase and lowercase letters, enclose the schema name and stored procedure name in double quotation marks. For example, job_action_proc=>'"Schema"."myProc"'. |
| number_of_arguments | The number of parameters required by the program. If you do not specify this parameter, the default value is 0, and the range is [0,255]. |
| enabled | Specifies whether to enable the created program. This attribute can be set to TRUE or FALSE. The default value is FALSE, which means the created program is disabled. If set to TRUE, the program will be created as enabled after the validity check is completed. By default, this attribute is set to FALSE, indicating that the created program is not enabled. You can also call the ENABLE procedure to enable the program. |
| comments | Comments about the program. By default, this attribute is NULL. |
Considerations
By default, the program is created in a disabled state (unless the enabled parameter is set to TRUE). Therefore, the job cannot execute the program. Other users must have the EXECUTE privilege to use your program.
Examples
BEGIN
DBMS_SCHEDULER.CREATE_PROGRAM(
PROGRAM_NAME => 'empprogram',
PROGRAM_TYPE => 'STORED_PROCEDURE',
PROGRAM_ACTION => 'hr.empprogram',
COMMENTS => 'Employee data management');
END;