CREATE OUTLINE

Syntax

Purpose

To create a stored outline, which is a set of attributes used by the optimizer to generate an execution plan. You can then instruct the optimizer to use a set of outlines to influence the generation of execution plans whenever a particular SQL statement is issued, regardless of changes in factors that can affect optimization. (To modify an outline so that it takes into account changes in these factors, see "ALTER OUTLINE".)

You enable or disable the use of stored outlines dynamically for an individual session or for the system. See "ALTER SESSION" and "ALTER SYSTEM".

Prerequisites

To create an outline, you must have the CREATEANYOUTLINE system privilege.

Keywords and Parameters

OR REPLACE

replaces an existing outline with a new outline of the same name.

outline

is the unique name to be assigned to the stored outline. If you do not specify outline, the system generates an outline name.

FOR CATEGORYcategory

specifies an optional name used to group stored outlines. For example, you could specify a category of outlines for end-of-week use and another for end-of-quarter use. If you do not specify category, the outline is stored in the DEFAULT category.

ONstatement

is the SQL statement for which Oracle will create an outline when the statement is compiled. You can specify any one of the following statements:

SELECT

DELETE

UPDATE

INSERT ... SELECT

CREATE TABLE ... AS SELECT

Note: You can specify multiple outlines for a single statement, but each outline for the same statement must be in a different category.

Example

The following statement creates a stored outline by compiling the ON statement. The outline is called SALARIES and is stored in the category SPECIAL.

CREATE OUTLINE salaries FOR CATEGORY special
ON SELECT ename, sal FROM emp;

When this same SELECT statement is subsequently compiled, if the USE_STORED_OUTLINES parameter is set to SPECIAL, Oracle generates the same execution plan as was generated when the outline SALARIES was created.