The PARSE stored procedure parses a DML statement (including SELECT). It also executes other statements such as DDL statements or system commands.
The following versions of PARSE subprograms are available:
One version supports
VARCHAR2arguments.Another version supports
VARCHAR2AorVARCHAR2Sarguments. For example, the PARSE stored procedure may concatenate segmented strings from an array to form an SQL statement and parse the result.Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Syntax
DBMS_SQL.PARSE(cursor_id IN INTEGER,
sql_stmt IN VARCHAR2,
language_flag IN INTEGER);
DBMS_SQL.PARSE(cursor_id IN INTEGER,
sql_stmt IN VARCHAR2A,
lb IN INTEGER,
ub IN INTEGER,
lfflg IN BOOLEAN,
language_flag IN INTEGER);
DBMS_SQL.PARSE(cursor_id IN INTEGER,
sql_stmt IN VARCHAR2s,
lb IN INTEGER,
ub IN INTEGER,
lfflg IN BOOLEAN,
language_flag IN INTEGER);
Parameters
| Parameter | Description |
|---|---|
| cursor_id | The ID of the cursor used to parse the statement or array. |
| sql_stmt | The SQL statement or array to parse. |
| lb | The lower bound of the array index. |
| ub | The upper bound of the array index. |
| lfflg | If this parameter is set to TRUE, a line break is inserted after every element on concatenation. |
| language_flag | Specifies the behavior for the SQL statement. |
Considerations
Using
DBMS_SQLto dynamically run DDL statements can cause the program to be unresponsive. For example, calling a subprogram in a package may cause the package to be locked until the execution returns to the user side. Any operation that causes a conflicting lock, such as attempting to drop the package before the first lock is released, will stop the program from running.Code on the client side cannot reference the variables or constants in a remote package. Therefore, you must explicitly use the value of the constants. For example, the following code cannot be compiled on the client:
DBMS_SQL.PARSE(cur_hdl,stmt_str,DBMS_SQL.NATIVE); -- This code uses the DBMS_SQL.NATIVE constant.The following code works on the client, because the argument is explicitly provided:
DBMS_SQL.PARSE(cur_hdl,stmt_str,1); -- This code compiles on the client.
Exceptions
If you create a type, procedure, function, or package by using DBMS_SQL that has compilation warnings, the PL unit will be created, but an exception is raised.