createTable
You are looking at an older version of the documentation. The latest version is found here.
This procedure creates a table of the provided format using a one-line command if it does not already exist.
Parameters
Parameter | Description |
---|---|
tableName | Fully-qualified name of the table to create; mandatory |
columnsAndTypes | Comma-delimited list of pairs columnName |dataType ; mandatory |
Attributes
Attribute | Type | Description |
---|---|---|
| string | Quoted fully-qualified name of the created table |
The procedure simplifies the connector code by providing a simplified interface to achieve a common task: create a table in the current VDB if it does not already exist. It will also format the table name and return the table's actual name if it is already present. This procedure helps avoid recurring code blocks that may introduce typos and errors.
Default column data type is a string and may be omitted.
Example
DECLARE string fullyQualifiedTableName = (
CALL UTILS.createTable (
tableName => 'dwh._TableName',
columnsAndTypes => 'stringColumn,intColumn|integer,decimalColumn|decimal,timestampColumn|timestamp,_crazyName'
)
);
This will assign the "dwh"."_TableName"
value to fullyQualifiedTableName
And create the table with the specified column names and data types. Please note that illegal underscores at the beginning of the names will also be quoted and handled correctly.
Here is the result returned by the example call: