SQL$HELP72.HLB  —  Select Expressions, Arguments  OPTIMIZE USING outline name
    Explicitly names the query outline to be used with the select
    expression even if the outline ID for the select expression and
    for the outline are different.

    The following example is the query used to create an outline
    named WOMENS_DEGREES:

    SQL> SELECT E.LAST_NAME, E.EMPLOYEE_ID, D.DEGREE, D.DEGREE_FIELD, D.YEAR_GIVEN
    cont> FROM EMPLOYEES E, DEGREES D WHERE E.SEX = 'F'
    cont> AND E.EMPLOYEE_ID = D.EMPLOYEE_ID
    cont> ORDER BY LAST_NAME

    By using the OPTIMIZE USING clause and specifying the WOMENS_
    DEGREES outline, you can ensure that Oracle Rdb attempts to use
    the WOMENS_DEGREES outline to execute a query even if the query
    is slightly different as shown in the following example:

    SQL> SELECT E.LAST_NAME, E.EMPLOYEE_ID, D.DEGREE, D.DEGREE_FIELD, D.YEAR_GIVEN
    cont> FROM EMPLOYEES E, DEGREES D WHERE E.SEX = 'F'
    cont> AND E.EMPLOYEE_ID = D.EMPLOYEE_ID
    cont> ORDER BY LAST_NAME
    cont> LIMIT TO 10 ROWS
    cont> OPTIMIZE USING WOMENS_DEGREES;
    ~S: Outline WOMENS_DEGREES used  <-- the query uses the WOMENS_DEGREES outline
       .
       .
       .
     E.LAST_NAME      E.EMPLOYEE_ID   D.DEGREE   D.DEGREE_FIELD    D.YEAR_GIVEN
     Boyd             00244           MA         Elect. Engrg.             1982
     Boyd             00244           PhD        Applied Math              1979
     Brown            00287           BA         Arts                      1982
     Brown            00287           MA         Applied Math              1979
     Clarke           00188           BA         Arts                      1983
     Clarke           00188           MA         Applied Math              1976
     Clarke           00196           BA         Arts                      1978
     Clinton          00235           MA         Applied Math              1975
     Clinton          00201           BA         Arts                      1973
     Clinton          00201           MA         Applied Math              1978
    10 rows selected

    See the CREATE OUTLINE statement for more information on creating
    an outline.
Close Help