diff --git a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/18_dbms_utility.mdx b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/18_dbms_utility.mdx index c172511ca88..304894334a3 100644 --- a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/18_dbms_utility.mdx +++ b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/18_dbms_utility.mdx @@ -20,6 +20,7 @@ The `DBMS_UTILITY` package provides support for the following utility programs. | `COMMA_TO_TABLE(list, tablen OUT, tab OUT)` | Procedure | n/a | Convert a comma-delimited list of names to a table of names. | | `DB_VERSION(version OUT, compatibility OUT)` | Procedure | n/a | Get the database version. | | `EXEC_DDL_STATEMENT (parse_string)` | Procedure | n/a | Execute a DDL statement. | +| `EXPAND_SQL_TEXT(input_sql_text, output_sql_text)` | Function | `TEXT` | Returns expanded SQL references to view. | | `FORMAT_CALL_STACK` | Function | `TEXT` | Formats the current call stack. | | `FORMAT_ERROR_BACKTRACE` | Function | `TEXT` | Formats the current error call backtrace. | | `FORMAT_ERROR_STACK` | Function | `TEXT` | Get the exception name. | @@ -378,6 +379,54 @@ ERROR:  EDB-20001: 'parse_string' must be a valid DDL statement In this case, EDB Postgres Advanced Server's behavior differs from Oracle's. Oracle accepts the invalid `parse_string` without complaint. +## EXPAND_SQL_TEXT + +The `EXPAND_SQL_TEXT` function returns an expanded version of a given SQL query by replacing view references with its definition. + +```sql +DBMS_UTILITY.EXPAND_SQL_TEXT( CLOB, OUT CLOB) +``` + +### Parameters + +`input_sql_text` + + The SQL query to expand. + +`output_sql_text` + + The expanded version of the given SQL query. + +### Example + +The following anonymous block returns an expanded version of the SQL query `SELECT * from vemp`: + +```sql +BEGIN +DBMS_UTILITY.expand_sql_text ( input_sql_text => 'SELECT * from vemp', output_sql_text => result ); +DBMS_OUTPUT.put_line(result); +END; + SELECT empno, + ename, + job, + mgr, + hiredate, + sal, + comm, + deptno + FROM ( SELECT emp.empno, + emp.ename, + emp.job, + emp.mgr, + emp.hiredate, + emp.sal, + emp.comm, + emp.deptno + FROM emp) vemp + +EDB-SPL Procedure successfully completed +``` + ## FORMAT_CALL_STACK The `FORMAT_CALL_STACK` function returns the formatted contents of the current call stack.