Previous Topic: Example 1Next Topic: Example 3


Example 2

Create an updateable view with the specifications listed in the following:

  1. View name: SUPPLY
  2. Column names: SNUM, SNAME, STATUS, CITY
  3. Search condition: The value of STATUS must be greater than 10

This view is a row and column subset view of the table CASUPL which contains columns SNUM, SNAME, STATUS, CITY, STATE and ZIP. View SUPPLY can be used to update values for the four specified columns. However, this view would not be used to insert new rows into CASUPL since some of the columns are not included in the view definition.

EXEC SQL
      CREATE VIEW SUPPLY
           (SNUM, SNAME, STATUS, CITY)
      AS SELECT ALL
           SNUM, SNAME, STATUS, CITY
      FROM CASUPL
      WHERE STATUS > 10
END-EXEC