How to understand and memorize a PL/SQL Function ?
Watching this 10 steps of a PL/SQL function you can very easily understand and memorize a Function format.
1.create or replace function f_name --(name of function)
2.(peramiter /*(2.1 ) in/out/in out */ in number) --(Parameter )
3.return varchar2 -- (Return)
4.IS --( use of IS or AS)
5.v varchar2(200) ; --(Declare variable if needed with ;)
6.begin --(Execution)
7.select first_name into v -- (Passing value into the variable using INTO )
from employees
where employee_id=n ;
8.return v ; --(Return value with ;)
9. exception ; --(Exception if needed with ;)
10. end ; --(End with ;)
To run the function:
select last_name , f_name(100) from employees
where employee_id=198;
Remember There are 10 Step in a Function
No comments:
Post a Comment