w3resource

PL/SQL Control Statement Exercises: Incentive achieved according to the specific sale limit

PL/SQL Control Statement: Exercise-6 with Solution

Write a PL/SQL procedure to calculate the incentive achieved according to the specific sale limit.

Sample Solution:

PL/SQL Code:

DECLARE
  PROCEDURE test1 (sal_achieve  NUMBER)
  IS
    incentive  NUMBER := 0;
  BEGIN 
    IF sal_achieve > 44000 THEN
      incentive := 1800;
    ELSIF sal_achieve > 32000 THEN
      incentive := 800;
    ELSE
      incentive := 500;
    END IF;
 DBMS_OUTPUT.NEW_LINE;
    DBMS_OUTPUT.PUT_LINE (
      'Sale achieved : ' || sal_achieve || ', incentive : ' || incentive || '.'
    );
  END test1;
BEGIN
  test1(45000);
  test1(36000);
  test1(28000);
END;
/

Sample Output:

Sale achieved : 45000, incentive : 1800.

Sale achieved : 36000, incentive : 800.

Sale achieved : 28000, incentive : 500.

PL/SQL procedure successfully completed.

Flowchart:

Flowchart: PL/SQL Control Statement Exercises: Incentive achieved according to the specific sale limit

Improve this sample solution and post your code through Disqus

Previous: Write a PL/SQL program to check whether a date falls on weekend i.e. SATURDAY or SUNDAY.
Next: Write a PL/SQL program to count number of employees in department 50 and check whether this department have any vacancies or not.

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://w3resource.com/plsql-exercises/control-statement/plsql-control-statement-exercise-6.php