You now have the employee data that is referenced by the APEX_TASKS.ASSIGNED_TO column but need to identify a foreign key between the tables APEX_ATASKS and APEX_EMPLOYEES. The foreign key ensures that each ASSIGNED_TO column references a valid Employee. It also ensures that an Employee cannot be deleted who has tasks assigned. Perform the following steps:
1. | Select the down arrow next to Object Browser > Browse and then select Tables. |
2. | Select the APEX_TASKS table and click the Constraints tab. |
3. | Click Create. |
4. | Select Foreign Key for the Constraint Type. Select Cascade Delete in constraint type, ASSIGNED_TO for the Foreign Key Column, select OBE_EMPLOYEES for the Reference Table Name and select EMPLOYEE_ID from the Reference Table Column List. Then click Next . |
5. | Click Finish. |
6. | The constraint was created successfully. You want to also create a check constraint on the PROJECT_PRIORITY column so that the data is validated when the data is inserted or updated. Select APEX_PROJECT_LOOKUP.
|
7. | Click the Create section tab.
|
8. | Select PROJECT_PRIORITY for the Constraint of Column field and enter in ('1','2','3') for the Constraint Expression. Ensure that Check Constraint Type is selected. Then click Next. |
9. | Click Finish. |
10. | The constraint was created successfully. Click the Home breadcrumb. |
No comments:
Post a Comment