How to add procedure and function in Block PL SQL ,
In This section we are learning how to create a procedure or a function in Initialization ( in DECLARE Section ) in ...
after that , how to call the procedure or the function in logic in body ( after begin) in oracle
declare
a number;
b number;
c number;
procedure find_min (x in number, y in number , z out number) is
begin
if x < y then
z:= x;
else
z:= y;
end if;
end;
function find_max (x in number , y in number) return number
is
z number;
begin
if x > y then
z:= x;
else
z:= y;
end if;
return z;
end;
begin
a := 23;
b := 45;
find_min(a , b , c);
dbms_output.put_line ('Minimum number is '|| c);
c := find_max(a , b);
dbms_output.put_line ('Maximum number is ' || c);
end;
/
if we're running or execute the procedure block in above, so the output that is ....
-----------------------------------------------
Output :
Minimum number is 23
Maximum number is 45
No comments:
Post a Comment