Skip to main content
Skip table of contents

createTable

This procedure creates a table of the provided format using a one-line command if it does not already exist.

Parameters

ParameterDescription
tableNameFully-qualified name of the table to create; mandatory
columnsAndTypesComma-delimited list of pairs columnName|dataType; mandatory

Attributes

Attribute

Type

Description

tableName

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

SQL
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 fullyQualifiedTableNameAnd 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:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.