A script-enabled browser is required for this page to function properly.

Retrieving result sets from queries or non-Oracle stored program units

The EXEC_SQL package is particularly useful when you need to retrieve result sets from different data sources into one report.

To process a statement that returns a result set:

  1. For each column, use EXEC_SQL.DEFINE_COLUMN to specify the variable for receiving the value.

  2. Execute the statement by calling EXEC_SQL.EXECUTE.

  3. Use EXEC_SQL.FETCH_ROWS to retrieve a row in the result set.

  4. Use EXEC_SQL.COLUMN_VALUE to obtain the value of each column retrieved by EXEC_SQL.FETCH_ROWS.

  5. Repeat Steps 3 and 4 until EXEC_SQL.FETCH_ROWS returns 0.

See also

About the EXEC_SQL built-in package

EXEC_SQL built-in package

EXEC_SQL built-in package examples

Changing the primary database connection

Connection and cursor handles

Copying data between two databases

EXEC_SQL predefined exceptions

About built-in packages