w3resource

PL/SQL Fundamentals Exercises: Calculate the incentive of an employee whose ID is 110

PL/SQL Fundamentals: Exercise-1 with Solution

Write a PL/SQL block to calculate the incentive of an employee whose ID is 110.

The following PL/SQL block shows a veriable incentive have been declared and incentive have assigned into this variable.

Sample Solution:

Table: employees

employee_id		integer
first_name		varchar(25)
last_name		varchar(25)
email			archar(25)
phone_number		varchar(15)
hire_date		date
job_id			varchar(25)
salary			integer
commission_pct		decimal(5,2)
manager_id		integer
department_id		integer

PL/SQL Code:

DECLARE
  incentive   NUMBER(8,2);
BEGIN
  SELECT salary * 0.12 INTO incentive
  FROM employees
  WHERE employee_id = 110;
DBMS_OUTPUT.PUT_LINE('Incentive  = ' || TO_CHAR(incentive));
END;
/

Sample Output:

Incentive  = 984

Statement processed.

0.00 seconds

Flowchart:

Flowchart: PL/SQL Fundamentals Exercise - Calculate the incentive of an employee whose ID is 110: Block to learn how to declare a character type variable

Improve this sample solution and post your code through Disqus

Previous: PL/SQL Fundamentals Exercises.
Next: Write a PL/SQL block to show an invalid case-insensitive reference to a quoted and without quoted user-defined identifier.

What is the difficulty level of this exercise?



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/plsql-exercises/fundamentals/plsql-fundamentals-exercise-1.php