Progress
Embedded SQL-92
Guide and Reference


SELECT Statement for a Single Row

Returns no more than one row in the result table. Use this statement in embedded SQL-92 programs to assign the values of a single row result table directly to host variables. The syntax for the single row form is similar to the general form of a SELECT statement, with these limitations:

SYNTAX

SELECT [ ALL | DISTINCT ]
  { expression [ [ AS ] [ ’] column_title [’ ] ]
  [, expr [ [ AS ] [ ’] column_title [’ ] ] ] , ...
  }
  INTO :host_variable [, :host_variable ] ,... [ { NO REORDER } ]
  FROM table_ref [, table_ref ] ... [ { NO REORDER } ] 
   [ WHERE search_condition ]
  [ GROUP BY clause ] 
  [ HAVING search_condition ]
  [ ORDER BY clause ] 
  [ FOR UPDATE clause ] 
  ; 

SELECT [ ALL | DISTINCT ]

If you specify the DISTINCT keyword, duplicate rows will be eliminated from the rows retrieved by the system. The default action is that all selected rows are returned.

INTO

In the single row form of the SELECT statement, the selected values are assigned to the host variables specified in the INTO clause. The INTO clause is required, and it must precede the FROM clause. If no rows are selected, the SQL_NOT_FOUND condition is returned in the SQLCA structure.

FROM

The FROM clause is required. If the same column name exists in more than one table specified in the FROM clause, you must qualify the column name with the table name or a table alias name.

WHERE

Specifies the selection criteria for rows. If you do not specify a WHERE clause, all the rows of the Cartesian product of all the tables in the FROM clause are returned.

GROUP BY

Specifies the groups of rows returned by the SELECT statement. For more information, see the “Query Expressions” section in Chapter 2, “SQL-92 Language Elements,” of the Progress SQL-92 Guide and Reference .

HAVING

Allows you to set conditions on the groups returned by a SELECT statement. For more information, see the “SELECT” reference section in Chapter 3, “SQL-92 Language Statements”, of the Progress SQL-92 Guide and Reference .

ORDER BY

Allows you to specify the order in which the SELECT statement returns rows.

FOR UPDATE

Specifies which rows are to be updated.

NOTES

AUTHORIZATION

The user executing this statement must have at least one of the following privileges:

SQL COMPLIANCE

SQL-92

ENVIRONMENT

Embedded SQL-92 only

RELATED STATEMENTS

None


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095