EXEC_SQL.PARSE
built-in procedureThis procedure parses a statement on a specified cursor.
PROCEDURE EXEC_SQL.PARSE
([connid IN CONNTYPE,]
curs_id IN CURSTYPE,
statement IN VARCHAR2
[language_flag IN PLS_INTEGER]);
Parameter |
Description |
|
Is the handle to the connection you want to use. If you
do not specify a connection, |
|
Is the cursor handle you want to assign the statement to. |
|
The SQL statement to be parsed. It should not include a final semicolon. |
|
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 |
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
.
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;
About the EXEC_SQL
built-in package
Copyright © 1984, 2005, Oracle. All rights reserved.