## Purpose
Creates a database view with associated user-definable SQL select statement. The SQL select statement can access any object available across all data containers of the database. A view is stored for the duration of the session in the data dictionary under the catalog DataDictionary and schema Custom. When creating, modifying and deleting views, it is not necessary to specify that the view is in the data dictionary; after all, there is only one place it can be. All defined views can be queried for using the data dictionary view SystemViews. Upon creation, the view is checked for syntactic correctness. Syntactic errors will lead to an error, unless the force option is also specified in the statement. Upon execution, both syntax and validity are checked against the then active database.
When using the replace clause, a previous version of the identical named view is replaced. Otherwise an error is raised when a view with the same name already exists. When using the if not exists clause (available from 25.0.41 and 24.0.778), the view is only created when a previous version of the identical named view did not exist.
To run the query associated with the view, it is necessary to specify the origin via the DataDictionary alias. A view can be embedded through it's name in another view or query as if it was a table.
Database views complement the unalterable Invantive-provided views which are always driver-specific. Invantive's driver-views only combine data within the driver that contains it. Driver-views can always be used independent of the database they are contained in, as long as the driver is present.
## Syntax
```mermaid
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart TD
createOrReplaceViewStatement_start((START))
createOrReplaceViewStatement_start --> createOrReplaceViewStatement_0_0[CREATE]:::quoted
createOrReplaceViewStatement_0_0 --> createOrReplaceViewStatement_0_1[OR]:::quoted
createOrReplaceViewStatement_0_1 --> createOrReplaceViewStatement_0_2[REPLACE]:::quoted
createOrReplaceViewStatement_0_2 --> createOrReplaceViewStatement_0_3[REPLACE]:::quoted
createOrReplaceViewStatement_0_3 --> createOrReplaceViewStatement_0_4[FORCE]:::quoted
createOrReplaceViewStatement_0_4 --> createOrReplaceViewStatement_0_5[VIEW]:::quoted
createOrReplaceViewStatement_0_5 --> createOrReplaceViewStatement_0_6[tableIdentifier]
createOrReplaceViewStatement_0_6 --> createOrReplaceViewStatement_0_7[AS]:::quoted
createOrReplaceViewStatement_0_7 --> createOrReplaceViewStatement_0_8[selectStatement]
createOrReplaceViewStatement_0_8 --> createOrReplaceViewStatement_end((END))
```