get_ddl
Return the DDL definition of an Oracle object as a CLOB string without executing it. Specify the object name and type (and schema when needed) to retrieve creation SQL.
Instructions
Return the DDL definition of an object as a CLOB string, using DBMS_METADATA.GET_DDL. Read-only: never executes the DDL. All three parameters (schema, name, type) are REQUIRED. Valid type values: TABLE, VIEW, INDEX, SEQUENCE, PROCEDURE, FUNCTION, PACKAGE, PACKAGE BODY, TRIGGER, TYPE, SYNONYM, DB LINK. schema/name/type are matched case-insensitively against ALL_OBJECTS (lowercase is fine) and the exact stored object is passed to GET_DDL, so a case mismatch never surfaces as ORA-31603. Requires SELECT_CATALOG_ROLE plus EXECUTE on SYS.DBMS_METADATA (granted in db/setup_least_privilege_user.sql); privilege or not-found failures surface as error results.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Object name. | |
| type | Yes | Object type, e.g. 'TABLE', 'VIEW', 'INDEX', 'PROCEDURE', 'FUNCTION', 'PACKAGE', 'SEQUENCE', 'TRIGGER'. | |
| schema | No | Schema (owner) of the object. Optional — defaults to the server's current schema; omit rather than guess. |