SlideShare a Scribd company logo
1 of 10
POWERPOINT

  PRESENTATION ON

PROCEDURE & FUNCTION
Procedures

A procedure is a block of statements
enclosed by some declaration statement with
control blocks and a matching declaration.
All executable statements is must be written
by some procedure.
Why to Create a Procedure

 It allow you to break your program into discrete logical
units, each of which can be debug more easily than an
entire program without procedures.
 It can also use as a building block for other programs.
 If you have code that performs the same task in
different places, you can write the task once as a
procedure and then call it from different places in your
code.
Types of Sub Procedure


General Procedure  It tells the application how
to perform a specific task. It may invoke
another application (function).
Event Procedure  Event procedures execute in
response to an event raised by user action or by
an occurrence in a program such as click event
of an object.
Function

A Function is a series of statements enclosed by the
certain module (of that system) and End Function
statements.
The Function procedure performs a task and then returns
control to the calling code. When it returns control, it
also may return a value to the calling module.
Parts of a Function
A Function has these parts:


Name Anything you like as long as it starts with a letter and
contains only letters numbers and underscores. (without any
space).
Argument List a list of the items of data that the function
needs.
Return Type if the type is Function this tells the compiler
what kind of thing will be returned, for instance, single row or
multi-row , group by etc.
Body all the statements that do the work is as sub procedure.
Passing by value (By Value): The procedure gets a copy
of the actual value of the argument.
function (number x)

Passing by reference (By Reference): The procedure
gets access to the argument's actual memory address.
function (number & x )

When a by reference parameter is used, the value of the
passed argument can be permanently changed by the
procedure.
Example of Procedure
declare
a number;
b number;
c number;
begin
a:=&a;
b:=&b;
c:=a+b;
dbms_output.put_line('a+b:');
dbms_output.put_line(c);
end;/
Example of Function Procedure
Some of the commonly used aggregate functions are :
• SUM
• COUNT
• AVG
• MIN
• MAX

declare
c number;
begin
select avg(sal) into c from EMPLOYEE;
dbms_output.put_line(c);
end;
/
Bibliography
• guidance from teachers
•internet
•books and other friends


This is presented to you by:
Avishek Chatterjee & Aatish Kumar Upaddhay

More Related Content

What's hot

What's hot (20)

introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
 
Stored procedure
Stored procedureStored procedure
Stored procedure
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
 
user defined function
user defined functionuser defined function
user defined function
 
Array ppt
Array pptArray ppt
Array ppt
 
Sql fundamentals
Sql fundamentalsSql fundamentals
Sql fundamentals
 
PL/SQL TRIGGERS
PL/SQL TRIGGERSPL/SQL TRIGGERS
PL/SQL TRIGGERS
 
DBMS Unit 2 ppt.ppt
DBMS Unit 2 ppt.pptDBMS Unit 2 ppt.ppt
DBMS Unit 2 ppt.ppt
 
C functions
C functionsC functions
C functions
 
SQL commands
SQL commandsSQL commands
SQL commands
 
Sql commands
Sql commandsSql commands
Sql commands
 
STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
 
Database abstraction
Database abstractionDatabase abstraction
Database abstraction
 
Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentation
 
Java Networking
Java NetworkingJava Networking
Java Networking
 
Database Keys
Database KeysDatabase Keys
Database Keys
 
DML Commands
DML CommandsDML Commands
DML Commands
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introduction
 
View of data DBMS
View of data DBMSView of data DBMS
View of data DBMS
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C Programming
 

Similar to Function & procedure

Chapter 11 Function
Chapter 11 FunctionChapter 11 Function
Chapter 11 Function
Deepak Singh
 

Similar to Function & procedure (20)

Lecture 11 - Functions
Lecture 11 - FunctionsLecture 11 - Functions
Lecture 11 - Functions
 
04. WORKING WITH FUNCTIONS-2 (1).pptx
04. WORKING WITH FUNCTIONS-2 (1).pptx04. WORKING WITH FUNCTIONS-2 (1).pptx
04. WORKING WITH FUNCTIONS-2 (1).pptx
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
 
Ch4 functions
Ch4 functionsCh4 functions
Ch4 functions
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Function
FunctionFunction
Function
 
User defined function in C.pptx
User defined function in C.pptxUser defined function in C.pptx
User defined function in C.pptx
 
Functionincprogram
FunctionincprogramFunctionincprogram
Functionincprogram
 
cp Module4(1)
cp Module4(1)cp Module4(1)
cp Module4(1)
 
Unit 1
Unit  1Unit  1
Unit 1
 
Chapter 11 Function
Chapter 11 FunctionChapter 11 Function
Chapter 11 Function
 
Subprogramms
SubprogrammsSubprogramms
Subprogramms
 
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptxUnit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
 
Functions
FunctionsFunctions
Functions
 
4. function
4. function4. function
4. function
 
Functions assignment
Functions assignmentFunctions assignment
Functions assignment
 
Generalized Functors - Realizing Command Design Pattern in C++
Generalized Functors - Realizing Command Design Pattern in C++Generalized Functors - Realizing Command Design Pattern in C++
Generalized Functors - Realizing Command Design Pattern in C++
 
Functions
FunctionsFunctions
Functions
 
CH.4FUNCTIONS IN C_FYBSC(CS).pptx
CH.4FUNCTIONS IN C_FYBSC(CS).pptxCH.4FUNCTIONS IN C_FYBSC(CS).pptx
CH.4FUNCTIONS IN C_FYBSC(CS).pptx
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

Function & procedure

  • 1. POWERPOINT PRESENTATION ON PROCEDURE & FUNCTION
  • 2. Procedures A procedure is a block of statements enclosed by some declaration statement with control blocks and a matching declaration. All executable statements is must be written by some procedure.
  • 3. Why to Create a Procedure It allow you to break your program into discrete logical units, each of which can be debug more easily than an entire program without procedures. It can also use as a building block for other programs. If you have code that performs the same task in different places, you can write the task once as a procedure and then call it from different places in your code.
  • 4. Types of Sub Procedure General Procedure  It tells the application how to perform a specific task. It may invoke another application (function). Event Procedure  Event procedures execute in response to an event raised by user action or by an occurrence in a program such as click event of an object.
  • 5. Function A Function is a series of statements enclosed by the certain module (of that system) and End Function statements. The Function procedure performs a task and then returns control to the calling code. When it returns control, it also may return a value to the calling module.
  • 6. Parts of a Function A Function has these parts: Name Anything you like as long as it starts with a letter and contains only letters numbers and underscores. (without any space). Argument List a list of the items of data that the function needs. Return Type if the type is Function this tells the compiler what kind of thing will be returned, for instance, single row or multi-row , group by etc. Body all the statements that do the work is as sub procedure.
  • 7. Passing by value (By Value): The procedure gets a copy of the actual value of the argument. function (number x) Passing by reference (By Reference): The procedure gets access to the argument's actual memory address. function (number & x ) When a by reference parameter is used, the value of the passed argument can be permanently changed by the procedure.
  • 8. Example of Procedure declare a number; b number; c number; begin a:=&a; b:=&b; c:=a+b; dbms_output.put_line('a+b:'); dbms_output.put_line(c); end;/
  • 9. Example of Function Procedure Some of the commonly used aggregate functions are : • SUM • COUNT • AVG • MIN • MAX declare c number; begin select avg(sal) into c from EMPLOYEE; dbms_output.put_line(c); end; /
  • 10. Bibliography • guidance from teachers •internet •books and other friends This is presented to you by: Avishek Chatterjee & Aatish Kumar Upaddhay