8. OpenSQL Statements : Select (embedded) : Non-Cursor Select
 
Share this page                  
Non-Cursor Select
The non-cursor version of the embedded SELECT statement can be used to retrieve a single row or a set of rows from the database.
If the optional begin-end block syntax is not used, the embedded SELECT statement can retrieve only one row from the database. This kind of SELECT statement is called the singleton select and is compatible with the ANSI standard. If the singleton select does try to retrieve more than one row, an error occurs and the result variables hold information from the first row.
For example, the following example retrieves a single row from the database:
EXEC SQL SELECT ename, sal
       INTO :ename, :sal
       FROM employee
       WHERE eno = :eno;