Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see Why Migrate to InterSystems IRIS?


Specifies the SQL query for this class. Applies only to view definition classes.


To specify the SQL query for this class, use the following syntax:

ViewQuery = { SELECT Name FROM Sample.Person}

The value of this keyword is an SQL statement, enclosed in curly braces.


When you define an SQL view (using the DDL CREATE VIEW statement or using the Management Portal), the system automatically creates a class definition to hold the view definition. For this class definition, ClassType is view, and ViewQuery equals the SQL statement on which the view is based.

This mechanism is internal; users are not expected to create view classes nor to modify the ViewQuery keyword. Instead, use the normal mechanisms (DDL or the Management Portal) for managing views.

This keyword is ignored for all non-view classes.


The default value is an empty string.

See Also