The GET_POST_PROCESSED_SOURCE function retrieves the conditionally compiled PL source code and returns it as a source_lines_t collection.
Applicability
This content applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support it.
Syntax
The GET_POST_PROCESSED_SOURCE function supports the following three overloads:
Retrieve by object type, schema name, and object name
DBMS_PREPROCESSOR.GET_POST_PROCESSED_SOURCE(
object_type VARCHAR2,
schema_name VARCHAR2,
object_name VARCHAR2)
RETURN source_lines_t;
Obtain by source code string
DBMS_PREPROCESSOR.GET_POST_PROCESSED_SOURCE(
source VARCHAR2)
RETURN source_lines_t;
Obtain from the source code repository
DBMS_PREPROCESSOR.GET_POST_PROCESSED_SOURCE(
source source_lines_t)
RETURN source_lines_t;
Parameters
Parameter |
Description |
|---|---|
| object_type | Type of the PL object to be processed. Supported types include:PACKAGE、PACKAGE BODY、PROCEDURE、FUNCTION、TRIGGER、TYPE、TYPE BODY. |
| schema_name | The name of the schema to which the object belongs. If it isNULL, the current schema is used. |
| object_name | Object name. |
| source | PL source code string orsource_lines_tCollection. |
Return value
Returns the source_lines_t collection type, which is defined as follows:
TYPE source_lines_t IS
TABLE OF VARCHAR2(32767) INDEX BY BINARY_INTEGER;
Usage instructions
- Retrieves the source code of a PL object from the database dictionary using overloaded forms of the object type, schema name, and object name, and preprocesses it.
- Directly preprocess the input string by using overloaded forms of the source code string.
- Each row in the results corresponds to a line of preprocessed source code.
- Overloading forms of the source code set are not currently supported.
Examples
DECLARE
result DBMS_PREPROCESSOR.source_lines_t;
i BINARY_INTEGER;
BEGIN
result := DBMS_PREPROCESSOR.GET_POST_PROCESSED_SOURCE(
'CREATE OR REPLACE PACKAGE my_pkg IS
$IF DBMS_DB_VERSION.VER_LE_21 $THEN
SUBTYPE my_type IS NUMBER;
$ELSE
SUBTYPE my_type IS VARCHAR2(100);
$END
PROCEDURE p;
END;');
i := result.FIRST;
WHILE i IS NOT NULL LOOP
DBMS_OUTPUT.PUT_LINE(result(i));
i := result.NEXT(i);
END LOOP;
END;
/
