You must initialize a materialized view to make it available for use by the database server. To initialize it, you refresh it. A failed refresh attempt returns the materialized view to an uninitialized state.
Before creating, initializing, or refreshing materialized views, ensure that all materialized view restrictions have been met. See Restrictions on materialized views.
You can also initialize all uninitialized materialized views at once using the sa_refresh_materialized_views system procedure. See sa_refresh_materialized_views system procedure.
Connect to the database as a user with DBA authority, or as a user with INSERT permission on the materialized view.
In the left pane, double-click Views.
Right-click a materialized view and choose Refresh Data.
Select an isolation level and click OK.
When you are done with this example, you should drop the materialized view you created. Otherwise, you will not be able to make schema changes to its underlying tables Employees and Departments, when trying out other examples. You cannot alter the schema of a table that has enabled, dependent materialized view. See Drop materialized views.
Connect to the database as a user with DBA authority, or as a user with INSERT permission on the materialized view.
Execute a REFRESH MATERIALIZED VIEW statement.
The following statements create a materialized view, EmployeeConfid6, and then initializes it:
CREATE MATERIALIZED VIEW EmployeeConfid6 AS SELECT EmployeeID, Employees.DepartmentID, SocialSecurityNumber, Salary, ManagerID, Departments.DepartmentName, Departments.DepartmentHeadID FROM Employees, Departments WHERE Employees.DepartmentID=Departments.DepartmentID; REFRESH MATERIALIZED VIEW EmployeeConfid6; |
When you are done with this example, you should drop the materialized view you created. Otherwise, you will not be able to make schema changes to its underlying tables Employees and Departments, when trying out other examples. You cannot alter the schema of a table that has enabled, dependent materialized view. See Drop materialized views.
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |