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

EXEC_SQL.PARSE built-in procedure

This procedure parses a statement on a specified cursor.

Syntax


PROCEDURE EXEC_SQL.PARSE
([connid IN CONNTYPE,]
curs_id IN CURSTYPE,
statement IN VARCHAR2
[language_flag IN PLS_INTEGER]);

Parameter

Description

connid

Is the handle to the connection you want to use. If you do not specify a connection, EXEC_SQL.DEFAULT_CONNECTION retrieves the primary connection handle from the cache.

curs_id

Is the cursor handle you want to assign the statement to.

statement

The SQL statement to be parsed. It should not include a final semicolon.

language_flag

A flag that determines how Oracle handles the SQL statement. The valid flags are:

V6 Specifies Oracle V6 behavior

V7 Specifies Oracle V7 behavior

NATIVE Default

 

Usage notes

All SQL statements must be parsed using the Parse procedure. Parsing checks the syntax of the statement and associates it with the cursor in your code. Unlike OCI parsing, EXEC_SQL parsing is always immediate. You cannot defer EXEC_SQL parsing.

You can parse any data manipulation language (DML) or data definition language (DDL) statement. For Oracle data sources, the DDL statements are executed on the parse. For non-Oracle data sources, the DDL may be executed on the parse or on the execute. This means you should always parse and execute all DDL statements in EXEC_SQL.

Example


PROCEDURE getData IS
 connection_id EXEC_SQL.CONNTYPE;
 cursorID EXEC_SQL.CURSTYPE;
 sqlstr VARCHAR2(1000);

...

BEGIN
  connection_id := EXEC_SQL.OPEN_CONNECTION(connect_str);
  cursorID := EXEC_SQL.OPEN_CURSOR(connection_id);
--
-- the statement to be parsed is stored as a VARCHAR2 variable
--
  sqlstr := 'select ename from emp';
--
-- perform parsing
--
  EXEC_SQL.PARSE(connection_id, cursorID, sqlstr, exec_sql.V7);
 ...

END;

See also

About the EXEC_SQL built-in package

EXEC_SQL built-in package