3rd Example - Substitution Variable (NUMBER) on PL/SQL

Substitution variable is dynamic variable. Substitution variable on its use in the PL / SQL block can receive input values ​​from outside the PL / SQL block. Input value can change each time the PL / SQL block is executed. Substitution variable indicated by “&” at the beginning of the variable name. Here is an example of PL / SQL block that has 2 substitution variables:

        Result NUMBER;
        Input1 NUMBER;
        Input2 NUMBER;
        Input1 := &in1;
        Input2 := &in2;
        Result := Input1 + Input2;

When executed, it will request 2 input values. For example in1 variable filled by 10 and in2 variable filled by 20, the result will be shown is 30.

No comments

Powered by Blogger.