Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you help me please INSTRUCTION. PL/SQL For the exercise below, you must create the Employee/Department database (script provided BELOW ). You must also create

Can you help me please

INSTRUCTION.

PL/SQL

For the exercise below, you must create the Employee/Department database (script provided BELOW ). You must also create a copy of the EMPLOYEES table. In order to create an exact copy of the EMPLOYEEES table, run the following SQL statement. Use your first and last initials in the new table name. For example, if your name is John Smith, then the new table name should be JS_EMPLOYEES. CREATE TABLE AA_employees (AA is my initials, you must use your initials instead of AA) AS SELECT * FROM EMPLOYEES; Create a PL/SQL block that updates the salary of every employee to a new value of 10000 in a chosen department. Include a user-defined exception handler that:

A) handles the condition where no rows are updated and display a custom message

B) will trap any other possible error condition and display the corresponding SQLCODE and SQLERRM.

Test your code three times for the department_ids: 20, 30, and 40

==============================Employee/Department database (script provided BELOW )==========================================

CREATE TABLE "EMPLOYEES" ("EMPLOYEE_ID" NUMBER(6,0), "FIRST_NAME" VARCHAR2(20), "LAST_NAME" VARCHAR2(25) CONSTRAINT "EMP_LAST_NAME_NN" NOT NULL ENABLE, "EMAIL" VARCHAR2(25) CONSTRAINT "EMP_EMAIL_NN" NOT NULL ENABLE, "PHONE_NUMBER" VARCHAR2(20), "HIRE_DATE" DATE CONSTRAINT "EMP_HIRE_DATE_NN" NOT NULL ENABLE, "JOB_ID" VARCHAR2(10) CONSTRAINT "EMP_JOB_NN" NOT NULL ENABLE, "SALARY" NUMBER(8,2), "COMMISSION_PCT" NUMBER(2,2), "MANAGER_ID" NUMBER(6,0), "DEPARTMENT_ID" NUMBER(4,0), "BONUS" VARCHAR2(5), CONSTRAINT "EMP_SALARY_MIN" CHECK (salary > 0) ENABLE, CONSTRAINT "EMP_ID_PK" PRIMARY KEY ("EMPLOYEE_ID") USING INDEX ENABLE, CONSTRAINT "EMP_EMAIL_UK" UNIQUE ("EMAIL") USING INDEX ENABLE );

========================================================== CREATE TABLE "DEPARTMENTS" ("DEPARTMENT_ID" NUMBER(4,0), "DEPARTMENT_NAME" VARCHAR2(30) CONSTRAINT "DEPT_NAME_NN" NOT NULL ENABLE, "MANAGER_ID" NUMBER(6,0), "LOCATION_ID" NUMBER(4,0), CONSTRAINT "DEPT_ID_PK" PRIMARY KEY ("DEPARTMENT_ID") USING INDEX ENABLE ); ALTER TABLE "DEPARTMENTS" ADD CONSTRAINT "DEPT_LOC_FK" FOREIGN KEY ("LOCATION_ID") REFERENCES "LOCATIONS" ("LOCATION_ID") ENABLE;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions