Class OracleSchemaDDL
java.lang.Object
org.odpi.openmetadata.adapters.connectors.resource.jdbc.ddl.oracle.OracleSchemaDDL
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
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.
currentSchema= JDBC URL parameter - Oracle has no equivalent way to set an
unqualified name's default schema from the connection string.-
Constructor Summary
ConstructorsConstructorDescriptionOracleSchemaDDL(String schemaName, String schemaDescription, List<OracleTable> tables) -
Method Summary
Modifier and TypeMethodDescriptionReturns the list of DDL statements to define the schema.
-
Constructor Details
-
OracleSchemaDDL
public OracleSchemaDDL(String schemaName, String schemaDescription, List<OracleTable> tables) throws InvalidParameterException - Throws:
InvalidParameterException
-
-
Method Details
-
getDDLStatements
Returns the list of DDL statements to define the schema.- Returns:
- list of statements
-