23.9 FORMAT_METADATA Function Signature 1

This procedure converts DBMS_DEVELOPER.GET_METADATA JSON output to readable text for human and LLM consumption.

Gather the JSON from DBMS_DEVELOPER.GET_METADATA at the "ALL" level for maximum information to be included in the output. If a lower level (e.g. "BASIC" or "TYPICAL") is used, some information may not be included.

Syntax

FUNCTION apex_db_dictionary.format_metadata (
    p_json                       IN   JSON,
    p_include_constraints        IN   BOOLEAN          DEFAULT TRUE,
    p_include_indexes            IN   BOOLEAN          DEFAULT FALSE,
    p_include_comments           IN   BOOLEAN          DEFAULT TRUE,
    p_include_annotations        IN   BOOLEAN          DEFAULT TRUE,
    p_include_domains            IN   BOOLEAN          DEFAULT TRUE,
    p_include_virtual_columns    IN   BOOLEAN          DEFAULT FALSE,
    p_format                     IN   t_format_type    DEFAULT C_MARKDOWN )
    RETURN CLOB;

Parameters

Parameter Description
p_json JSON output from DBMS_DEVELOPER.GET_METADATA.
p_include_constraints Show constraints section (default TRUE)
p_include_indexes Show indexes section (default FALSE)
p_include_comments Show table/column comments (default TRUE)
p_include_annotations Show table/column annotations (default TRUE)
p_include_domains Show SQL Domain metadata section (default TRUE)
p_include_virtual_columns Include virtual columns in output (default FALSE)
p_format c_markdown (default) or c_plain

Returns

CLOB containing formatted table description.

Example

This example calls the DBMS_DEVELOPER API to get the JSON metadata for the EMP table at the maximum level of detail. Selected metadata is extracted and combined with additional metadata from the database (e.g. comments) and converted to markdown format by APEX_DB_DICTIONARY.format_metadata.

declare
    l_text clob;
begin
    l_text := apex_db_dictionary.format_metadata(
                  dbms_developer.get_metadata(
                      object_type => 'TABLE',
                      name        => 'EMP',
                      level       => 'ALL' ) );
end;