Database Reference
In-Depth Information
Example 4: Change the Computer Science department name to 'Department of
Computer Science and Mathematics'; change the department head to Professor Hans
Gaur (staff code of “S20”):
Note: This is an example of a simple update (assuming that “CSC” is the unique code
for the department). The record that satisfies the condition specified in the Where-Clause
is fetched and updated.
Example 5: Assign all male students in the BSC in MIS to Urvine Hall:
Note: This is an example of a multiple update. All records satisfying the condition
specified are fetched and updated. This also illustrates what was referred to as set-at-a-time
update in Chapter 9.
Example 6: Change the course code CS100 to CS105:
Note:
1.
It is not a good practice to change codes that are primary key
since it increases the possibility of violation of the referential
integrity rule.
2.
The Oracle DBMS will allow such updates providing that no
violation of the referential integrity rule would result; if a
violation would result, the instruction would be disallowed
(also true for DB2). An alternative to this approach is to
restrict the update of primary keys (the system would allow
insertion and deletion only), except in the case where the
DBMS introduces and maintains surrogates, transparent to
the end user. Still another alternative is to allow cascaded
update, but this would be very expensive.
Example 7: The following statement uses execution time variable in an Update
statement:
 
Search WWH ::




Custom Search