DROP VIEW

DROP VIEW removes the definition of a view recorded by CREATE VIEW.

Syntax

Notes

The DROP will fail if there are any objects (for example, another view or a pump) that depend on the view - unless the CASCADE option is specified. The default is RESTRICT.

Example

The first attempt to drop X fails (because view Y depends on view X). The second attempt, with the CASCADE option, succeeds - and also drops view Y as a consequence.

0: jdbc:sqlstream:> CREATE VIEW X AS SELECT * FROM TEST_TABLE;
No rows affected (1.552 seconds)
0: jdbc:sqlstream:> SELECT * FROM X;
+-----+------------+
| ID  | TEXTVALUE  | 
+-----+------------+
+-----+------------+
No rows selected (4.046 seconds)
0: jdbc:sqlstream:> CREATE VIEW Y AS SELECT * FROM X;
No rows affected (2.103 seconds)
0: jdbc:sqlstream:> DROP VIEW X;
Error: Dropping view "TEST"."X" requires CASCADE because
       other objects still reference it (state=,code=0)
0: jdbc:sqlstream:> DROP VIEW X CASCADE;
No rows affected (0.752 seconds)
0: jdbc:sqlstream:> SELECT * FROM Y;
Error: At line 1, column 15: Table 'Y' not found (state=,code=0)
0: jdbc:sqlstream:>