Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DATABASE PROGRAMMING CREATE TABLE dept ( deptno NUMBER(2,0), dname VARCHAR2(14), loc VARCHAR2(13), CONSTRAINT n_pk_dept PRIMARY KEY (deptno) ); CREATE TABLE emp( empno NUMBER(4,0), ename VARCHAR2(10),

DATABASE PROGRAMMING

CREATE TABLE dept ( deptno NUMBER(2,0), dname VARCHAR2(14), loc VARCHAR2(13), CONSTRAINT n_pk_dept PRIMARY KEY (deptno) ); CREATE TABLE emp( empno NUMBER(4,0), ename VARCHAR2(10), job VARCHAR2(9), mgr NUMBER(4,0), hiredate DATE, sal NUMBER(7,2), comm NUMBER(7,2), deptno NUMBER(2,0), 

Cursor for update) Based on table employees. Write an anonymous PL/SQL program, it will go over each employees in the department (ID) 80 (Sales department). For those employees in department 80, if their salary is $6,999 or less, then increase their commission rate (commission_pct) by 10%. That means, their new rate will be 1.1 of the current rate.

Your program should declare a cursor with FOR UPDATE, thus it will request the system to lock those records retrieved, and your program can change these records later.

After update, print out related info for those affected employees, display their ID, last name, salary, the commission rate before and after this change.

Please remember to roll back your change at the end of the program.

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

More Books

Students also viewed these Databases questions