CREATE OR REPLACE VIEW [IMAGE]

Use the CREATE OR REPLACE VIEW [IMAGE] statement to create or replace a view definition and optionally the corresponding RAM image.

Usage

CREATE OR REPLACE VIEW viewname[(column-list)]
AS SELECT select-list
[CASCADE [{CREATE | DROP} IMAGES] [IGNORE ERRORS]]
[COMPRESSED]
[PARTITION IMAGE BY (column-list)]
[ORDER IMAGE BY (column-list)]

CREATE OR REPLACE VIEW IMAGE viewname[(column-list)]
[AS SELECT select-list
[CASCADE [{CREATE | DROP} IMAGES] [IGNORE ERRORS]]]
[COMPRESSED]
[PARTITION IMAGE BY (column-list)]
[ORDER IMAGE BY (column-list)]

CREATE OR REPLACE VIEW IMAGE viewname[(column-list)]
HASHED [ON](column-list)
[AS SELECT select-list
[CASCADE [{CREATE | DROP} IMAGES] [IGNORE ERRORS]]]
[COMPRESSED]
[PARTITION IMAGE BY (column-list)]
[ORDER IMAGE BY (column-list)]

CREATE OR REPLACE VIEW IMAGE viewname[(column-list)]
REPLICATED
[AS SELECT select-list
[CASCADE [{CREATE | DROP} IMAGES] [IGNORE ERRORS]]]
[COMPRESSED]
[PARTITION IMAGE BY (column-list)]
[ORDER IMAGE BY (column-list)]

Notes

If the command is used to create or replace the image of an existing view then the SELECT statement is not required.

If the signature of the view (i.e. the ordered list of column names and types) is unchanged, Kognitio will change the details of the view in the system tables to reflect the new definition.

If the signature has changed, this command will only succeed if there are no dependent views. If this is not the case, use the CASCADE option

CREATE OR REPLACE VIEW ... CASCADE

The CASCADE option forces the definition of this view and any dependents to be regenerated (so a view with a lot of dependents will take longer than the corresponding non-cascade option). If any dependent views have images the command will return an error; to avoid this use the {CREATE | DROP} IMAGES option

CREATE OR REPLACE VIEW ... CASCADE {CREATE | DROP} IMAGES

This indicates that existing images of the view and any dependents should be recreated or dropped.

If CREATE IMAGES is specified, the target view for the command will have a random image generated. To specify a different distribution use the CREATE OR REPLACE VIEW IMAGE command.

In addition, the IGNORE ERRORS option can be specified with the CASCADE and {CREATE | DROP} IMAGES options; this indicates any dependent views which can no longer be created because their definition is now invalid should be removed. If a dependent view image cannot be created although the view definition is still valid, the view definition will still exist but the image will not.

CREATE OR REPLACE VIEW IMAGE allows replacement of an existing view image. If no distribution is specified a random image of the view will be created regardless of any previous distribution.

See CREATE VIEW and CREATE VIEW IMAGE for additional details of view and view image creation.