Global Variable :
Global variable are variable that are declared in outermost
block and available for all inner blocks.
Local Variable :
Local variable are variables those are declared in inner
block and available for only that inner block.
Declare
l_num1 number:= & a;
l_num2 number:= & b; --Global variable
l_total number;
BEGIN
total:=l_num1+l_num2;
DBMS_OUTPUT.PUT_LINE ('Sum of given numbers is ' ||l_total);
Declare
l_num2 number:=0; --Local variable
BEGIN
DBMS_OUTPUT.PUT_LINE ('The value store in numbers 2 is ' ||l_num2);
end;
DBMS_OUTPUT.PUT_LINE ('The value store in numbers 1 is ' ||l_num1);
end;
No comments:
Post a Comment
Please do not enter any spam link in the comment box.