0% found this document useful (0 votes)
3 views

Explanation Function Plsql

The document outlines the creation of several PLSQL functions, including one to concatenate an employee's first and last name, one to calculate the square of a number, and a function to compute annual salary from monthly salary. It provides example code for the square and name concatenation functions, demonstrating their execution using DBMS_OUTPUT. The document also prompts the reader to create and test the annual salary function independently.

Uploaded by

swanandibagwe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Explanation Function Plsql

The document outlines the creation of several PLSQL functions, including one to concatenate an employee's first and last name, one to calculate the square of a number, and a function to compute annual salary from monthly salary. It provides example code for the square and name concatenation functions, demonstrating their execution using DBMS_OUTPUT. The document also prompts the reader to create and test the annual salary function independently.

Uploaded by

swanandibagwe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

A function in PLSQL is a named subprogram that performs specific computation or task and returns a

single value to the caller.

Assignment:

Create a function to concatenate the first name and Last name of an employee.
Create a function that calculate the annual salary based on the monthly salary input and test the function.

Create a function to calculate the square of a number.

CREATE or REPLACE FUNCTION cal_sqr


( num in number) return number
Is
Ans number;
Begin
Ans:= num*num;
return ans;
End;
/

Execution of function

Set serveroutput on
Declare
Square number;
Begin
Square:=cal_sqr(5);
DBMS_OUTPUT.PUT_LINE('square is ' ||square);
End;
/

Create a function to concatenate the first name and Last name of an employee.
CREATE or replace FUNCTION name_concat
( fname in varchar2,
Lname in varchar2) return varchar2
Is
result varchar2(100);
Begin
result :=fname|| ' ' ||lname;
Return result;
End;
/

Execution of function

Set serveroutput on
Declare
Name varchar2(100);
Begin
Name:=name_concat(' raj', ' jadhav');
DBMS_OUTPUT.PUT_LINE('FULLNAME is ' ||Name);
End;
/

Create a function that calculate the annual salary based on the monthly salary input and test the
function. (DO it YOURSELF)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy