STORED FUNCTION IN PLStructuredQueryL.pptx

aryanshaw621 9 views 6 slides Mar 10, 2025
Slide 1
Slide 1 of 6
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6

About This Presentation

SQL


Slide Content

Stored Function in PL/SQL

Benefits of Stored Functions Efficiency: These offer a significant performance improvement because a single call to a stored procedure can invoke multiple SQL statements. Reusability: A PL/SQL program is written once and can be used in a variety of situations. Portability: A PL/SQL program once made in one OS can be run in any OS. Maintainability: As it can be reused again and again, maintenance cost is low.

Difference between Stored Procedure and Stored Function Procedure does not return value Whereas Function always returns value

Example 1 create or replace function F1( Deg_f in number ) return number is Deg_c number; begin Deg_c := (5/9)* Deg_f – 32/9; return Deg_c ; end;

Example 2 create or replace function F2(e in number) return number is basic emp.sal%type ; da emp.sal%type ; hra emp.sal%type ; tot emp.sal%type ; begin select sal into basic from emp where eno =e; da :=basic; hra :=0.15*basic; tot:= basic+da+hra ; return tot; end;

Thank You
Tags