| Oracle® TimesTen In-Memory Database SQL Reference Release 11.2.1 Part Number E13070-03 | 
 | 
| 
 | View PDF | 
The CREATE PROCEDURE statement creates a standalone stored procedure.
Required privilege
CREATE PROCEDURE (if owner) or CREATE ANY PROCEDURE (if not owner)
CREATE [OR REPLACE] PROCEDURE [Owner.]ProcedureName [(argument [IN|OUT|IN OUT][NOCOPY] datatype [DEFAULT expr][,...])] [invoker_rights_clause] [DETERMINISTIC] {IS|AS} plsql_procedure_body
The syntax for the invoker_rights_clause:
AUTHID {CURRENT_USER|DEFINER}
You can specify invoker_rights_clause or DETERMINISTIC in any order.
Parameters
The CREATE PROCEDURE statement has the parameters:
| Parameter | Description | 
|---|---|
| OR REPLACE | Specify OR REPLACEto re-create the procedure if it already exists. Use this clause to change the definition of an existing procedure without dropping and recreating it. When you re-create a procedure, TimesTen recompiles it. | 
| ProcedureName | Name of procedure. | 
| argument | Name of argument/parameter. You can specify 0 or more parameters for the procedure. If you specify a parameter, you must specify a data type for the parameter. The data type must be a PL/SQL data type. For more information on PL/SQL data types, see Oracle Database PL/SQL Language Reference. | 
| [IN| OUT |IN OUT] | Parameter modes. 
 
 
 
 | 
| NOCOPY | Specify NOCOPYto instruct TimesTen to pass the parameter as fast as possible. Can enhance performance when passing a large value such as a record, an index-by-table, or a varray to anOUTorIN OUTparameter.INparameters are always passedNOCOPY.For more information on  | 
| DEFAULTexpr | Use this clause to specify a DEFAULTvalue for the parameter. You can specify:=in place of the keywordDEFAULT. | 
| invoker_rights_clause | Lets you specify whether the procedure executes with the privileges and in the database of the user who owns it or with the privileges and in the database of the CURRENT_USER.Specify  Specify  
 For more information, see Oracle Database SQL Language Reference. | 
| DETERMINISTIC | Specify DETERMINISTICto indicate that the procedure should return the same result value whenever it is called with the same values for its parameters.For more information on the  | 
| IS|AS | Specify either ISorASto declare the body of the procedure. | 
| plsql_procedure_body | Specifies the procedure body. | 
Restrictions
TimesTen does not support:
call_spec clause
AS EXTERNAL clause
The CREATE PROCEDURE statement is not replicated.
Description
The namespace for PL/SQL procedures is distinct from the TimesTen built-in procedures. You can create a PL/SQL procedure with the same name as a TimesTen built-in procedure.
When you create or replace a procedure, the privileges granted on the procedure remain the same. If you drop and re-create the object, the object privileges that were granted on the original object are revoked.
Examples
Create a procedure query_emp to retrieve information about an employee. Pass the employee_id 171 to the procedure and retrieve the last_name and salary into two OUT parameters.
Command> CREATE OR REPLACE PROCEDURE query_emp
       >           (p_id IN employees.employee_id%TYPE,
       >            p_name  OUT employees.last_name%TYPE,
       >            p_salary OUT employees.salary%TYPE) IS
       >         BEGIN
       >           SELECT last_name, salary INTO p_name, p_salary
       >           FROM employees
       >           WHERE employee_id = p_id;
       >         END query_emp;
       >         /
 
Procedure created.
See also
Oracle Database PL/SQL Language Reference and Oracle Database SQL Language Reference