CodesJava

Easy learning with example program codes

How to execute a function in plsql?


Pl sql function:

The pl sql function is a named PL/SQL block which performs one or more specific tasks and must returns a value.

create or replace function getMultiple(num1 in number, num2 in number)    
return number    
is     
  num3 number(8);    
begin    
  num3 :=num1*num2;    
  return num3;    
end;    
/

A functions return value can be assign to a variable.
result := getMultiple(4, 5);
As a part of a SELECT statement:
SELECT getMultiple(4, 5) FROM dual;
In a PL/SQL Statement:
dbms_output.put_line(getMultiple(4, 5));

See more at: Plsql function.

Related topics

Sign Up/ Sign In
Ask a Question


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki