Progress
SQL-89
Guide and Reference
Updating Views
When you update a view, you update the underlying table for the view. The same SQL data manipulation statements update rows in views and tables. For example, to add new rows using a view, use the INSERT INTO statement. Substitute the view name for the table name to manipulate the rows.
Updates to views can be limited by the view definitions used to create them. Your choice of keywords, expressions, constants, and aggregate functions in the SELECT statement determines whether you can update a view. You can specifically impose restrictions on updating views using the CHECK OPTION keywords as a run-time security feature or by setting restricted privileges on the view.
You can update the underlying database through the view as long as the view is updatable. A view is updatable only if you observe the following restrictions:
- The view definition must not include the keyword DISTINCT, a GROUP BY clause, a HAVING clause, or contain expressions, constants, or aggregate functions in the SELECT list.
- The FROM clause of the SELECT statement in the view definition must specify only one table.
- The WHERE clause, if any, cannot include a subquery.
- If the FROM clause references a view, that view must be updatable.
- If a view is defined with the CHECK OPTION, you should know the criteria for the view-defining condition before attempting to update and insert rows. If you try to update a view that does not satisfy the view-defining condition, the update (or insert) is rejected, and Progress returns the error message, “VIEW INSERT OR UPDATE VIOLATES THE VIEW DEFINITION.”
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |