Optional  Specify the CASCADE keyword to drop any other view that references view-name. Specify RESTRICT to issue an SQLCODE -321 error if there is another view that references view-name. The default is RESTRICT.

Description

The DROP VIEW command removes a view, but does not removes the underlying tables or data.

A drop view operation can also be invoked using the DropView() method call:

The DROP VIEW command is a privileged operation. Prior to using DROP VIEW it is necessary for your process to have either %DROP_VIEW administrative privilege or a DELETE object privilege for the specified view. Failing to do so results in an SQLCODE -99 error (Privilege Violation). You can determine if the current user has DELETE privilege by invoking the %CHECKPRIV command. You can determine if a specified user has DELETE privilege by invoking the $SYSTEM.SQL.CheckPriv() method. You can use the GRANT command to assign %DROP_VIEW privileges, if you hold appropriate granting privileges.

The default is No (0). This is the recommended setting for this option. Set this option to Yes (1) if you want DROP VIEW and DROP TABLE for nonexistent views and tables to perform no operation and issue no error message.

VIEW Referenced by Other Views

If you try to delete a view referenced by other views in their queries, DROP VIEW issues an SQLCODE -321 error by default. This is the RESTRICT keyword behavior.

By specifying the CASCADE keyword, an attempt to delete a view referenced by other views in their queries succeeds. The DROP VIEW also deletes these other views. If InterSystems IRIS cannot perform all cascade view deletions (for example, due to an SQLCODE -300 error) no views are deleted.

The following embedded SQL example creates a view named "CityAddressBook" and later deletes the view. Because it is specified with the RESTRICT keyword (the default), an SQLCODE -321 error is issued if the view is referenced by other views: