Previous Topic

Next Topic

Select (embedded)

Valid in: ESQL

The Select statement returns values from tables to host language variables in an embedded SQL program. For details about the various clauses of the select statement, see Select (interactive). The following sections discuss details of interest to the embedded SQL programmer.

Previous Topic

Next Topic

Syntax

The Select (embedded) statement has the following format:

Non-cursor version:

EXEC SQL [REPEATED] SELECT [FIRST rowCount] [ALLl | DISTINCT]
              SELECT [FIRST rowCount] [ALL | DISTINCT]
              INTO variable[:indicator_var] {, variable[:indicator_var]}
              [FROM from_source {, from_source}
              [WHERE search_condition]
              [GROUP BY column {, column}]
              [HAVING search_condition]]
              [UNION [all] full_select]
              [ORDER BY ordering-expression [ASC | DESC]
                            {, ordering-expression [ASC | DESC]}]
[EXEC SQL BEGIN;
              program code;
EXEC SQL END;]

To retrieve long varchar or long byte columns, specify a data handler routine in the into clause. For details, see Retrieving Values into Host Language Variables.

Cursor version (embedded within a declareexpression | result_name = expression | expression as result_name cursor statement):

SELECT [ALL|DISTINCT]
       SELECT [FIRST rowCount] [ALL | DISTINCT]
       [FROM from_source {, from_source}
       [WHERE search_condition]
       [GROUP BY column {, column}]
       [HAVING search_condition]
       [UNION [ALL] full_select]
       [ORDER BY result_column [ASC|DESC]
              {, result_column [ASC|DESC]}]
       [FOR [DEFERRED | DIRECT] UPDATE OF column {, column}];

where result_expression is:

expression | result_name = expression | expression as result_name


© 2007 Ingres Corporation. All rights reserved.