CST2355 Lab06b Spring2024
CST2355 Lab06b Spring2024
Hand-in:
1. The lab assignment will be graded out of a maximum 3 points. (a maximum of 1.5 points for
the portion handed in during the lab session, and an additional 1.5 points for the portion
handed in before the due date.)
2. This template should be used to submit your lab assignment. That means you should
save a copy of these instructions and then add your screenshots and other notes to that
copy. Then submit the updated version to Brightspace. This will thoroughly document
your work and make it much easier to review before the midterm test.
3. Make sure you have enough screenshots to completely document that you have completed all
the steps.
Activities (Steps):
In this lab, you will continue using MS-Access as a front-end application against an Oracle database.
You will be creating views in Oracle as a mechanism to simplify application programming to show
current values of fields, while keeping a history of changes to those fields in a set of tables in the
Oracle database. You will be building a set of triggers that update the history tables for each insert,
update, or deletion. The MS-Access forms can link either to the view (seeing the current version of
all fields) or to the individual history tables for each of the fields that is chosen for having its changes
recorded in the history tables.
1. Make sure you have signed the attendance sheet for your lab session! (Otherwise, you will
receive a grade of 0 for this lab.)
1.1. You also need to submit a version of the lab assignment submission before the end of
the lab session that includes all activities up to and including step 6 in order to receive a
grade on the first part of this individual lab. You will be able to hand in a complete,
carefully documented, version of the entire lab (including step 7) up to the Brightspace
due date – that is the upcoming Sunday August 4 at 11:59pm.
2. Receive your updated lab instructions from your lab instructor at the beginning of the lab session
and enter them here:
2.1. Special table name(s):__enter your notes here _________________________________
2.2. Special field name(s):__ enter your notes here _________________________________
2.3. Detailed instructions:
(enter your notes here)
Part A: Use SQL Developer to make the following changes to the database.
3.1.2. Provide a screenshot showing the successful running of the sequences script.
function should have mandatory fields for birthdate and password, and optional fields for
each of the other data fields in the telephone, address, and name tables.
4.3. Provide a screenshot or screenshots showing the package specification (just the package
specification – not the entire package body) below:
5. Provide the package body for customer_pkg using the following criteria.
5.1.1. Each procedure should insert a new telephone/address/name as appropriate
5.1.2. Each procedure should update the entry in the relationship association table to have
the sysdate timestamp as the enddate for the current entry (that is the one with NULL
enddate gets updated to have enddate as sysdate). If there is no previous related item
(i.e., no current entry with a NULL enddate) then this step should get skipped.
5.1.3. Each procedure should insert a new record in the relationship association table that
has the startdate as sysdate and a NULL enddate.
5.1.4. The new_customer() function should create the customer record along with the
telephone, address, and name records as required. If all the non-key fields in a
telephone, address or name record would be null, then the associated record should not
be created. [NOTE: The new_customer function should use the three stored
procedures in the package to create the related records.]
5.1.5. Provide screenshots for the three stored procedures below:
6. Use SQL Developer to create a VIEW that contains the IDCUSTOMER, birthdate, password,
current firstname, and current lastname.
6.1. Name the view ‘CUSTOMER_VIEW’.
6.2. Build the associated SELECT statement by currenfinding the current name by using a where
clause that specifies the entry in CUSTOMER_NAME where the ENDDATE is NULL.
6.3. Provide a screenshot to show your “CREATE VIEW” source code.
THIS IS THE POINT AT WHICH YOU NEED TO PROVIDE YOUR WORK BEFORE THE END
OF THE LAB SESSION TO RECEIVE PART MARKS.
Note: The remainder of the lab activities can be either submitted during the lab session, or submitted
later in Brightspace before the final deadline.
7. Once the view has been created, create an INSTEAD OF trigger on the CUSTOMER_VIEW to
allow updates to the customer’s name, while maintaining the history of previous names; by
following these criteria:
7.1.1. The trigger should be invoked for INSERTs or UPDATEs.
7.1.2. The trigger should update the CUSTOMER_NAME table entry that matches the
IDCUSTOMER and has the ENDDATE as NULL, to have the current SYSDATE as the
ENDDATE.
7.1.3. The trigger should use the CNAME_SEQ sequence and insert a new record into the
CNAME table.
7.1.4. The trigger should use the CN_SEQ sequence to insert a new record into the
CUSTOMER_NAME table. The new record should link the new CNAME record to the
e e current SYSDATE as the STARTDATE, and also setting ENDATE to the value
NULL to indicate that xisting CUSTOMER record; using th the new name is the
currently valid name.
7.1.5. Provide a screenshot to show the trigger source code.
7.1.6. Provide screenshot(s) to show the successful “insert” of a customer using the VIEW
and the associated updates to customer_name and cname.
8.1.1. Option 1: Update the current name to have an ENDDATE set to SYSDATE. Then
you will mark the main entry in the CUSTOMER table as “deleted” using a new field;
or
8.1.2. Option 2: Alter the customer table to have a CASCADE delete so that all related
records are deleted. When the delete happens – the entire history for that customer is
deleted.
8.2. Indicate here which option you have chosen: (option 1 or option 2):
8.4. Provide one or more screenshots to show the execution of a deletion against the
CUSTOMER_VIEW, and the resulting contents in the associated tables.
9. Once you have embedded all of your screenshots, I would encourage you to show the result to
your lab professor – if you are done in the lab session. Make sure you have included all of your
screen shots to document your work and submit the file in Brightspace and you’re done!