java.lang.Object
org.odpi.openmetadata.adapters.connectors.resource.jdbc.ddl.oracle.OracleSchemaDDL

public class OracleSchemaDDL extends Object
Builds up the definition of a schema, its tables, columns, primary keys, foreign keys and comments, using Oracle Database's SQL/PL-SQL dialect.

Oracle's DDL diverges from both PostgreSQLSchemaDDL and MSSQLSchemaDDL in a few important ways:
  • An Oracle "schema" is a database user - there is no separate namespace-creation statement equivalent to "CREATE SCHEMA". Users are expected to be provisioned ahead of time (with their tablespace quota and session/table privileges set up by a DBA), so no schema-creation DDL is generated here.
  • Oracle SQL has no "IF NOT EXISTS" clause on CREATE TABLE/ALTER TABLE ADD, so idempotency is achieved with the standard Oracle technique of wrapping the DDL in an anonymous PL/SQL block that ignores ORA-00955 (name already used by an existing object) / ORA-01430 (column being added already exists).
  • Oracle has no "COMMENT ON SCHEMA"/"COMMENT ON USER" statement, so a schema description cannot be recorded natively and is silently skipped. COMMENT ON TABLE and COMMENT ON COLUMN, however, are natively supported and are idempotent (re-running them simply overwrites the previous comment), so no guard is required there.
  • Oracle foreign key constraints support no "ON UPDATE" clause at all (Oracle expects primary keys to be immutable), so only the "ON DELETE" behaviour is generated.
Table names passed to this class are expected to already be schema-qualified (eg "schemaName.tableName"), since - unlike PostgreSQL's currentSchema= JDBC URL parameter - Oracle has no equivalent way to set an unqualified name's default schema from the connection string.