The EXEC_SQL package allows you to access multiple Oracle database servers on several different connections at the same time.
The EXEC_SQL package contains procedures and functions you can use to execute dynamic SQL within PL/SQL procedures. Like the DBMS_SQL package, the SQL statements are stored in character strings that are only passed to or built by your source program at runtime. You can issue any data manipulation language (DML) or data definition language (DDL) statement using the EXEC_SQL package.
The EXEC_SQL package differs from the DMBS_SQL package in the following ways:
For more information about the DBMS_SQL package, see your Oracle Application Developer's Guide.
Package Name | Description |
---|---|
EXEC_SQL.Invalid_Connection | An invalid connection handle is passed. |
EXEC_SQL.Package_Error | Any general error. Use EXEC_SQL. Last_Error_Code and EXEC_SQL.Last_Error_Mesg to retrieve the error. |
EXEC_SQL.Invalid_Column_Number | The EXEC_SQL.Describe_Column procedure encountered a column number that does not exist in the result set. |
EXEC_SQL.Value_Error | The EXEC_SQL.Column_Value encountered a value that is different from the original value retrieved by EXEC_SQL.Define_Column. |
The EXEC_SQL package is particularly useful when you need to retrieve result sets from different Oracle or ODBC data sources into one form or report. To process a statement that returns a result set:
The functions and procedures are listed in the order they are usually called in a session.
The following functions retrieve information about the last referenced cursor in a connection after a SQL statement execution.