6th Example - IF Selection on PL/SQL

PL/SQL is a reliable programming language. AS well as other programming languages​​, PL/SQL also able to perform the selection operation. There are 2 types of selection operations on PL/SQL, the choice of IF and CASE WHEN selection. Here is an example of using IF selections on PL/SQL block:

        Var1 NUMBER;
        Hasil VARCHAR2(16);
        Var1 := &n1;
        IF Var1 >= 70 THEN
                        Hasil := 'Great';
        ELSIF Var1 >=60 AND Var1 < 70 THEN
                        Hasil := 'Good';
                        Hasil := 'Poor';
        END IF;
        DBMS_OUTPUT.PUT_LINE (Hasil);

In the PL/SQL block above, there is a substitution variable that will receive number  input value. If the number entered >= 70 then output is great, if the input value is between 60 and 70 then the output is Good, other than that its output is Poor.

No comments

Powered by Blogger.