Listing a Single Table or View

From InterBase
Jump to: navigation, search

The FROM clause in the following SELECT specifies a single table, EMPLOYEE, from which to retrieve data:

EXEC SQL
SELECT LAST_NAME, FIRST_NAME, SALARY
INTO :lanem, :fname, :salary
FROM EMPLOYEE
WHERE LNAME = 'Smith';

Use the same INTO clause syntax to specify a view or select procedure as the source for data retrieval instead of a table. For example, the following SELECT specifies a select procedure, MVIEW, from which to retrieve data. MVIEW returns information for all managers whose last names begin with the letter “M,” and the WHERE clause narrows the rows returned to a single row where the DEPT_NO column is 430:

EXEC SQL
SELECT DEPT_NO, LAST_NAME, FIRST_NAME, SALARY
INTO :lname, :fname, :salary
FROM MVIEW
WHERE DEPT_NO = 430;

For more information about select procedures, see Working with Stored Procedures.