Previous Topic: Select-StatementNext Topic: SET CURRENT SQLID


Select-Into Statement

►►─ SELECT ─┬────────────┬────────────────────────────────────────────────────►
            ├─ ALL ◄ ────┤
            └─ DISTINCT ─┘

 ►─┬─ * ────────────────────────────────────────────┬─ INTO ──────────────────►
   │ ┌─ , ────────────────────────────────────────┐ │
   └─▼─┬─ expression ─┬───────────────────────┬─┬─┴─┘
       │              └┬────┬ sql-identifier ─┘ │
       │               └ AS ┘                   │
       └─┬─ table-name.* ───────┬───────────────┘
         ├─ view-name.* ────────┤
         └─ correlation-name.* ─┘

   ┌─ , ─────────────┐        ┌─ , ─────────┐
 ►─▼─ host-variable ─┴─ FROM ─▼─┤table-ref├─┴─────────────────────────────────►

 ►─┬────────────────────────────┬─────────────────────────────────────────────►◄
   └─ WHERE ─ search-condition ─┘

Expansion of table-ref

├──┬─┬─ table-name ─┬─┬──────┬─┬────────────────────┬─┬────────────────────────┤
   │ └─ view-name ──┘ └─ AS ─┘ └─ correlation-name ─┘ │
   └─┤alternate-join-type├────────────────────────────┘

Expansion of table-ref

├──┬─┬─ table-name ─┬─┬────────────────────┬─┬─────────────────────────────────┤
   │ └─ view-name ──┘ └─ correlation-name ─┘ │
   └─┤alternate-join-type├───────────────────┘

Expansion of alternate-join-type

├──┬─────┬─ table-ref ─┬─ INNER ────────────┬─────────────────────────────────►
   └─ ( ─┘             └─ LEFT ─┬─────────┬─┘
                                └─ OUTER ─┘

 ►─ JOIN table-ref ─┬─────────────┬─┬─────┬────────────────────────────────────┤
                    └─ ON s-cond ─┘ └─ ) ─┘

The s-cond (search-condition) in this optional ON clause differs from the one in the WHERE clause in that the ON clause defines the join conditions that determine which rows contain nulls, as opposed to the WHERE clause, which eliminates rows from the result entirely. Also, if you use the optional parentheses, they must be balanced, that is, if you use an open parenthesis, you must also use a close parenthesis.

The select-into statement is not used by CA Dataquery.