Deleting Through a View

From InterBase

Go Up to Deleting Data (Embedded SQL Guide)


You can delete entire rows through a view if the following conditions are met:

  • The view is updatable. For a complete discussion of updatable views, see the Data Definition Guide.
  • A user or stored procedure has DELETE privilege for the view.

For example, the following statement deletes all departments with budgets under $1,000,000, from the DEPARTMENT table through the PART_DEPT view:

EXEC SQL
DELETE FROM PART_DEPT
WHERE BUDGET < 1000000;

For information about creating a view, see Working with Data Definition Statements. For CREATE VIEW syntax, see the Language Reference Guide.

Note:
See “Working with Triggers” in the Data Definition Guide for tips on using triggers to delete through non-updatable views.

Advance To: