CP5503 - Enterprise Database Systems - Oracle Assignment

Assignment Help Other Subject
Reference no: EM132620190

CP5503 - Enterprise Database Systems - Oracle Assignment - James Cook University, JCU, Australia

Assignment Part - Trigger

Firstly, you have to setup the user lib_jcxxxxxx account and create the required tables. To do so, you must use the 3 given files in ass2_sql_files.zip. You should perform the following steps:

1. Run SQL Developer

2. Connect Oracle DB by the user system

3. Open the script create_user.sql and change jc000000 to your jc username, for example, jc123456

4. Run the script create_user.sql

5. You can now disconnect the system connection

6. Connect Oracle DB by the user lib_jcxxxxxx

7. Open the script lib_tables.sql and run it

Note: lib_tables.sql creates tables with basic constraints, no additional constraints

8. Open the script insert_records.sql and run it

If there is anything wrong, you can always re-run the 3 files again.

You have to login as a lib_jcxxxxxx user to write SQL and PL/SQL to define triggers, stored procedures/functions as specified in the following subsections. You should also include SQL/PLSQL statements to test the triggers and procedures/functions that you must implement. Make sure that you test single row as well as multiple row actions. Include comments for each testing statement to indicate the trigger or the procedure/function in which it applies and the expected results of the trigger firing or procedure/function executing.

Task 1 - TR_date_returned_chk trigger

You should create a trigger called TR_date_returned_chk (Loan table) to compare date_returned to the current system date before updating a row in Loan table. If date_returned is greater than the current system date then raise an application error.

Task 2 - Create FUNC_is_available_copy function

Create a function called FUNC_is_available_copy to check if a copy is available or not. This function should contain the following input parameter: copy_id_p. It should return 1 if available and 0 if not available.

Task 3 - Create TR_add_loan trigger

You should create a trigger called TR_ add_loan. This trigger fires before inserting a row in the Loan table. If the copy_id is not available then raise an application error. Hint: Use the function FUNC_is_available_copy.

Task 4 - Create FUNC_get_book function

Create a function called FUNC_get_book to retrieve book_id, title, shelf_letter, call_number and no_of_copies with a given isbn. This function should contain the following input parameter: isbn_p; the following output parameters: title_p, shelf_letter_p, call_number_p and no_of_copies_p. It should return the book_id if found and -1 if not found.

Task 5 - Create TR_insert_or_update_book trigger

Create a trigger called TR_insert_or_update_book. This trigger fires after inserting or updating a row in the Book table. For inserting, it will add its corresponding copy records into Copies table. If a book has 5 copies then 5 copy records will be added into the Copies table. The copy_number in the Copies table must be between 1 and no_of_copies. For updating, if the new value of no_of_copies is less than the old value then raise an application error. If the new value of no_of_copies is greater than the old one then write a log record into the Log table and add additional copy records into the Copies table as well. Hint: copy_id should be obtained by the SELECT sequence_name.NEXTVAL/CURRVAL INTO sequence_value FROM dual.

Attachment:- Enterprise Database Systems – Oracle Assignment Files.rar

Reference no: EM132620190

Questions Cloud

Describe the strategic alternatives in brief : Strategic Alternatives: Imagine a nonprofit organization trying to raise funds for cancer research. What types of strategic alternatives might such.
Why is it often difficult to develop a realistic analysis : Identify and describe the areas of a SWOT analysis and discuss why it is important to consider these areas when developing a strategic plan. Why is it often.
Further substantiate his argument or compose rebuttal : Explain why the manager may have said it and then further substantiate his argument or compose a rebuttal.
Is the tax to be entered as assets or expenses : Our company had an empty land its not generating any revenues , but we are paying annual property tax. is this tax to be entered as assets or expenses?
CP5503 - Enterprise Database Systems - Oracle Assignment : CP5503 - Enterprise Database Systems - Oracle Assignment Help and Solution - James Cook University, JCU, Australia - Assessment Writing Service
Conduct a swot analysis using given information : Select an organization or a department; develop and submit a one- to two- page paper (excluding cover page and references pages) that outlines the strengths.
Discuss purpose of using diagnostic instrument : Discuss the purpose of using a diagnostic instrument/model to help manage change.
Would reha record the deposit in accounts payable : One of Cristina's peanut butter catering, Would Reha record this deposit in accounts payable or receivable? Would it be a debit or a credit? How do you know?
Can you identify the company dividend policy : Can you identify the company's dividend policy? Have they adopted a stable dividend, a constant dividend payout ratio, a residual dividend

Reviews

Write a Review

Other Subject Questions & Answers

  Identify the stakeholders impacted by the project

Patient outcomes and the fulfillment of care goals is one of the major ways that healthcare success is measured. Measuring patient outcomes results.

  What are the names of the shows-films observed

What are the names of the shows/films observed and what year they were produced? What job was observed in the shows/films?

  Describe the evaluation of the selected research instrument

Describe the evaluation of the selected research instrument in the case report. Lastly,explain in full the tenets, rationale for selection (empirical evidence).

  Components to the structure of personality

According to Freud there are three components to the structure of personality. Name and describe these components

  Describe the differences between real life and hollywood

Describe the differences between "real life" and Hollywood. Also address this is dangerous for the public to have a hollywood impression of what fire islike.

  How would you advise your staff to react

As a healthcare leader, how would you react to a situation involving one of the ethical dilemmas? How would you advise your staff to react?

  Communism of soviet russia

If the communism of Soviet Russia and the communist block post WWII is THE alternative to capitalism, history has rendered its economic judgment

  What the role of an industrial hygienist

Question: let me know if you have ever worked with an industrial hygienist. Then, in your own words, tell me what the role of an industrial hygienist would be within your industry, agency, or workplace?

  Show correlations between the risk factors and behaviors

Identify a risk factor from each category and cite evidence that will show correlations between the risk factors and behaviors. Offer your opinion.

  Relationship of european immigrants and native american

The relationship of European immigrants and Native American settlers may best be described as

  Identify flaws in the design of the report of employees

Given the guidelines presented in this chapter, identify flaws in the design of the Report of Employees shown below. What assumptions about users and tasks did you make in order to assess this design? Redesign this report to correct these flaws.

  Identify a major issue the organization is facing

Identify a major issue the organization is facing and in which dimension (of the eight identified above) it is underperforming. Explain the ramifications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd