﻿ PL/SQL Control Statement: Calculate the incentive on a specific target otherwise a general incentive to be paid using IF-THEN-ELSE - w3resource # PL/SQL Control Statement Exercises: Calculate the incentive on a specific target otherwise a general incentive to be paid using IF-THEN-ELSE

## PL/SQL Control Statement: Exercise-4 with Solution

Write a PL/SQL procedure to calculate the incentive on a specific target otherwise a general incentive to be paid using IF-THEN-ELSE.

Sample Solution:

PL/SQL Code:

``````DECLARE
PROCEDURE test1 (
sal_achieve  NUMBER,
target_qty  NUMBER,
emp_id NUMBER
)
IS
incentive   NUMBER := 0;

BEGIN
IF sal_achieve > (target_qty + 200) THEN
incentive := (sal_achieve - target_qty)/4;
ELSE
incentive :=75;
END IF;
DBMS_OUTPUT.PUT_LINE ('incentive = ' || incentive);
UPDATE emp
SET salary = salary + incentive
WHERE employee_id = emp_id;

END test1;
BEGIN
test1(2300, 2000, 144);
test1(3600, 3000, 145);
END;
/
``````

Sample Output:

```incentive = 75
incentive = 150
```

Flowchart: Improve this sample solution and post your code through Disqus

What is the difficulty level of this exercise?

﻿
{"ft_lang_label":"__label__en","ft_lang_prob":0.6534254,"math_prob":0.91739273,"size":1571,"snap":"2021-43-2021-49","text_gpt3_token_len":397,"char_repetition_ratio":0.1480536,"word_repetition_ratio":0.11666667,"special_character_ratio":0.25015914,"punctuation_ratio":0.14176245,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97725827,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,null,null,5,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-12-06T15:20:29Z\",\"WARC-Record-ID\":\"<urn:uuid:38f75da3-c48e-43c8-9302-fe4bd356ac45>\",\"Content-Length\":\"125881\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:4720869b-19b9-4c03-9ca8-17c0c81edce7>\",\"WARC-Concurrent-To\":\"<urn:uuid:b69fbeea-0ef0-4093-9148-01a6be308b48>\",\"WARC-IP-Address\":\"104.26.14.93\",\"WARC-Target-URI\":\"https://w3resource.com/plsql-exercises/control-statement/plsql-control-statement-exercise-4.php\",\"WARC-Payload-Digest\":\"sha1:JEZBZNZE3D4YZYENAVH2BZRXFPVCVJIH\",\"WARC-Block-Digest\":\"sha1:APSMRJWBTZF6FSC3OKKOADE46QZ5J2XO\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-49/CC-MAIN-2021-49_segments_1637964363301.3_warc_CC-MAIN-20211206133552-20211206163552-00467.warc.gz\"}"}