First page Back Continue Last page Graphics

Finding a Row and Updating a Foreign Key Value


Notes:

Finding a Row and Updating a Foreign Key Value

This sample code looks up an employee and reassigns the employee to a different department. It uses the following steps:

1. Finds the employees view object

2. Constructs a key to find employee number 101

3. Finds the row that matches this key

4. Prints the employee’s name

5. Prints the current value of the employee’s department

6. Assigns the employee to a different department

7. Prints the new value of the employee’s department

8. Rolls back the transaction

Here is the output of this code:

Employee Name: Kochhar

Employee is in department 90

Employee reassigned to department 60

Transaction cancelled