Create Table
In this section you could find information about TABLES, their syntax and current convertions.
1. Description
In Oracle, the CREATE TABLE statement is used to create one of the following types of tables: a relational table which is the basic structure to hold user data, or an object table which is a table that uses an object type for a column definition. (Oracle documentation)
Oracle syntax
CREATE [ { GLOBAL | PRIVATE } TEMPORARY | SHARDED | DUPLICATED | [ IMMUTABLE ] BLOCKCHAIN
| IMMUTABLE ]
TABLE
[ schema. ] table
[ SHARING = { METADATA | DATA | EXTENDED DATA | NONE } ]
{ relational_table | object_table | XMLType_table }
[ MEMOPTIMIZE FOR READ ]
[ MEMOPTIMIZE FOR WRITE ]
[ PARENT [ schema. ] table ] ;Snowflake Syntax
CREATE [ OR REPLACE ]
[ { [ { LOCAL | GLOBAL } ] TEMP | TEMPORARY | VOLATILE | TRANSIENT } ]
TABLE [ IF NOT EXISTS ] <table_name> (
-- Column definition
<col_name> <col_type>
[ inlineConstraint ]
[ NOT NULL ]
[ COLLATE '<collation_specification>' ]
[
{
DEFAULT <expr>
| { AUTOINCREMENT | IDENTITY }
[
{
( <start_num> , <step_num> )
| START <num> INCREMENT <num>
}
]
[ { ORDER | NOORDER } ]
}
]
[ [ WITH ] MASKING POLICY <policy_name> [ USING ( <col_name> , <cond_col1> , ... ) ] ]
[ [ WITH ] TAG ( <tag_name> = '<tag_value>' [ , <tag_name> = '<tag_value>' , ... ] ) ]
[ COMMENT '<string_literal>' ]
-- Additional column definitions
[ , <col_name> <col_type> [ ... ] ]
-- Out-of-line constraints
[ , outoflineConstraint [ ... ] ]
)
[ CLUSTER BY ( <expr> [ , <expr> , ... ] ) ]
[ ENABLE_SCHEMA_EVOLUTION = { TRUE | FALSE } ]
[ STAGE_FILE_FORMAT = (
{ FORMAT_NAME = '<file_format_name>'
| TYPE = { CSV | JSON | AVRO | ORC | PARQUET | XML } [ formatTypeOptions ]
} ) ]
[ STAGE_COPY_OPTIONS = ( copyOptions ) ]
[ DATA_RETENTION_TIME_IN_DAYS = <integer> ]
[ MAX_DATA_EXTENSION_TIME_IN_DAYS = <integer> ]
[ CHANGE_TRACKING = { TRUE | FALSE } ]
[ DEFAULT_DDL_COLLATION = '<collation_specification>' ]
[ COPY GRANTS ]
[ COMMENT = '<string_literal>' ]
[ [ WITH ] ROW ACCESS POLICY <policy_name> ON ( <col_name> [ , <col_name> ... ] ) ]
[ [ WITH ] TAG ( <tag_name> = '<tag_value>' [ , <tag_name> = '<tag_value>' , ... ] ) ]2. Sample Source Patterns
2.1. Physical and Table Properties
Oracle
Snowflake
2.2. Constraints and Constraint States
The following constraints and constraint states will be commented out
ENABLEconstraint stateUSING INDEXClauseCHECKConstraint
Oracle
Snowflake
2.3. Foreign Key
If there is a table with a NUMBER column with no precision nor scale, and another table with a NUMBER(*,0) column that references to the previously mentioned NUMBER column, we will comment out this foreign key.
Oracle
Snowflake
2.4. Virtual Column
Oracle
Snowflake
2.5. Identity Column
For identity columns, a sequence is created and assigned to the column.
Oracle
Snowflake
2.6. CLOB and BLOB column declaration
Columns declared as CLOB or BLOB will be changed to VARCHAR.
Oracle
Snowflake
2.7. Constraint Name
Oracle
Snowflake
2.8. Default columns with times
The columns declared as Date types will be cast to match with the specific date type.
Oracle
Snowflake
3. Known Issues
Some properties on the tables may be adapted to or commented out because the behavior in Snowflake is different.
4. Related EWIs
MSCEWI1002: Removed next statement, not applicable in SnowFlake.
MSCEWI3041: Enable/disable constraint state removed from not null inline constraint.
MSCEWI3024: Table properties were removed because Snowflake does not require them.
MSCEWI1035: Check statement not supported.
MSCEWI3040: Virtual keyword removed from the column definition.
MSCEWI1036: Data type converted to another data type.
Last updated
Was this helpful?