Search This Blog

Saturday, July 8, 2017

Easy way to understand and catch a PL/SQL Function ( 10 step of a Function)

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) 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

Split A String By Coma (,)

Step 1.  create or replace type split_tbl as table of varchar2(32767); Step 2. create or replace function split (     p_list varchar2,...