Category: PL/SQL Functions

PL/SQL Function to Check Number is Even or Odd 0

PL/SQL Function to Check Number is Even or Odd

Follow me PL/SQL Function to Check Number is Even or Odd: create or replace function evn_od(no in number) return varchar is ans varchar(50); begin if(mod(no,2) = 0) then ans:=’Even Number’; else ans:=’Odd Number’; end...

PL/SQL Function to Check Number is Prime or Not 0

PL/SQL Function to Check Number is Prime or Not

Follow me PL/SQL Function to Check Number is Prime or Not: create or replace function check_prime(no in number) return varchar is ans varchar(15); n number; begin if(no = 2)then ans:=’Prime’; else n:=no/2; for i...

PL/SQL Function to Accept Number and Display in Words 0

PL/SQL Function to Accept Number and Display in Words

Follow me PL/SQL Function to Accept Number and Display in Words: create or replace function ntw(no in number) return varchar is n_t_w varchar(50); c number; str varchar(50); begin for i in 1..length(no) loop c:=substr(no,i,1);...

PL/SQL Function to Display City of Employee 0

PL/SQL Function to Display City of Employee

Follow me PL/SQL Function to Display City of Employee: create or replace function get_city(vid in number) return varchar is ciity varchar(15); begin select city into ciity from employee e,address a where a.eid=e.id and e.id=vid;...

PL/SQL Function to Find Highest Salary of Employee 0

PL/SQL Function to Find Highest Salary of Employee

Follow me PL/SQL Function to Find Highest Salary of Employee: create or replace function hig_sal return varchar is vname varchar(15); begin select name into vname from employee where salary=(select max(salary) from employee); return(vname); end;

PL/SQL Function to Find Power of Numbers 0

PL/SQL Function to Find Power of Numbers

Follow me PL/SQL Function to Find Power of Numbers: create or replace function powr(x in number,y in number) return number is pno number; begin select power(x,y) into pno from dual; return(pno); end; Calling Function:...

PL/SQL Function to Find Square of Number 0

PL/SQL Function to Find Square of Number

Follow me PL/SQL Function to Find Square of Number: create or replace function sqr(no in number) return number is sqr_no number; begin sqr_no:=no*no; return(sqr_no); end; Calling Function: declare ono number; sqno number; begin ono:=:ono;...

PL/SQL Function to Accept Emp No and Returns Employee Details 0

PL/SQL Function to Accept Emp No and Returns Employee Details

Follow me PL/SQL Function to Accept Emp No and Returns Employee Details: create or replace function detail(no in number) return varchar is tot_det varchar(50); vid number; vname varchar(15); vsal number; begin select id,name,salary into...

PL/SQL Function to Calculate Annual Income of Employee 0

PL/SQL Function to Calculate Annual Income of Employee

Follow me PL/SQL Function to Calculate Annual Income of Employee: create or replace function tot_cal(veno in number) return number is atax number(20); totsal number(20); begin select salary*12 into totsal from employee where id=veno; atax:=Round(totsal*0.1);...