Hiding a materialized view

You can hide a materialized view's definition from users. When you hide a materialized view, you obfuscate the view definition stored in the database.

Prerequisites

You must have DBA authority, or be the owner of the materialized view

Context and remarks

When a materialized view is hidden, debugging using the debugger will not show the view definition, nor will the definition be available through procedure profiling, and the view can still be unloaded and reloaded into other databases.

Hiding a materialized view is irreversible and only possible using SQL.

 Hide a materialized view using SQL
  1. Connect to the database.

  2. Execute an ALTER MATERIALIZED VIEW ... SET HIDDEN statement.

Results

The view is no longer visible when browsing the catalog. The view can still be directly referenced, and is still eligible for use during query processing.

Next

None.

Example

The following statements create a materialized view, EmployeeConfid3, refreshes it, and then obfuscates its view definition.

CREATE MATERIALIZED VIEW EmployeeConfid3 AS
   SELECT EmployeeID, Employees.DepartmentID, SocialSecurityNumber, Salary, ManagerID,
      Departments.DepartmentName, Departments.DepartmentHeadID
   FROM Employees, Departments
   WHERE Employees.DepartmentID=Departments.DepartmentID;
REFRESH MATERIALIZED VIEW EmployeeConfid3;
ALTER MATERIALIZED VIEW EmployeeConfid3 SET HIDDEN;
Caution

When you are done running the following 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.


 See also