SQL provides the following ways to invoke an executable SQL statement:
- Interactively from a terminal
- Embedded within an application program
- Dynamically performed from within an embedded application
- Embedded within a stored procedure or external stored procedure
Executable SQL Statements
An executable SQL statement performs an action. The action can be on data or on a transaction or another entity at a higher level than raw data.
Examples of executable SQL statements:
- SELECT
- CREATE TABLE
- COMMIT
- CONNECT
- PREPARE
Most executable SQL statements can be performed interactively from a terminal using an SQL query manager like BTEQ.
The following types of executable SQL commands cannot be performed interactively:
- Cursor control and declaration statements
- Dynamic SQL control statements
- Stored procedure control statements and condition handlers
- Connection control statements
- Special forms of SQL statements such as SELECT ... INTO
These statements can only be used within an embedded SQL or stored procedure application.
Nonexecutable SQL Statements
A nonexecutable SQL statement is one that declares an SQL statement, object, or host or local variable to the preprocessor or stored procedure compiler. Nonexecutable SQL statements are not processed during program execution.
Examples of nonexecutable SQL statements for embedded SQL applications include:
- DECLARE CURSOR
- BEGIN DECLARE SECTION
- END DECLARE SECTION
- EXEC SQL
Examples of nonexecutable SQL statements for stored procedures include:
- DECLARE CURSOR
- DECLARE
SQL Requests
A request to Vantage can span any number of input lines. Vantage can receive and perform SQL statements that are:
- Embedded in a client application program that is written in a procedural language.
- Embedded in a stored procedure.
- Entered interactively through BTEQ interfaces.
- Submitted in a BTEQ script as a batch job.
- Submitted through other supported methods (such as CLIv2, ODBC, and JDBC).
- Submitted from a C or C++ external stored procedure using CLIv2 or a Java external stored procedure using JDBC.