Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

SUB PROGRAMS

Sub programs are the named PL SQL blocks that can take parameters and can be invoked. Types: Procedures Functions FunctionFunctions are like procedures that perform action. The only difference is that functions return a value. Types: local and stored 1. Local functions- That are defined in declaration section of the program. Example:SQL> ed great Declare A number; B number; Result number; Function great (A number, B number) return number As C number; Begin C=A*B Return(C); End product; Begin A:= &A; B:= &B; Result:= great(A,B);

dbms_output.put_line(product = ||result); end; / 2. Stored functions- that are stored in oracle engine. Example:SQL> ed great Create or replace function great (A number, B number, C number) return number As Begin If (A>B and A>C) then Return A; Elsif (A<B and C<B) then Return B; Else Return C; Endif; End great; /

You might also like