Description
You can execute the CREATE OUTLINE statement to create an outline. You can use an SQL text or SQL statement ID to create an outline. An SQL text indicates an original SQL statement that contains parameters. Note
Before you create an outline, log on to the database for which you want to create the outline.
Syntax
- Use an SQL text to create an outline.
CREATE [OR REPLACE] OUTLINE outline_name ON stmt [ TO target_stmt ]
- Use an SQL statement ID to create an outline.
CREATE OUTLINE outline_name ON sql_id USING HINT hint;
Parameters
| Parameter | Description |
|---|---|
| outline_name | The name of the outline that you want to create. |
| OR REPLACE | Replace an existing outline with a new outline of the same name. |
| stmt | The original data manipulation language (DML) statement that contains hints and parameters. |
| TO target_stmt | You can leave TO target_stmt empty if the following requirements are met: The original parameterized SQL statement is equivalent to the stmt value without hints. In this case, the system generates an execution plan for the parameterized SQL statement that has the hints in stmt. To generate a fixed execution plan for a statement that contains hints, specify the original SQL statement as TO target_stmt. Notice Make sure TO target_stmt you specify is the same as the stmt value without hints. |
| sql_id | Assume that the SQL statement of the specified ID contains hints. When you create an outline, the hints you specify overwrite all existing hints in the original statement. |
| hint | The value must be in the /*+ xxx */ format. |
Examples
- Use an SQL text to create an outline.
CREATE OUTLINE otl_idx_c2
ON SELECT/*+ index(t1 idx_c2)*/ * FROM t1 WHERE c2 = 1;
- Use an SQL statement ID to create an outline.
CREATE OUTLINE otl_idx_c2
ON "ED570339F2C856BA96008A29EDF04C74"
USING HINT /*+ index(t1 idx_c2)*/ ;
Notes
The outline created by using an SQL text prevails and overwrites that created by using an SQL statement ID.