SlideShare a Scribd company logo
PROCEDURE : Stored Procedures and Anonymous(External) Procedures

FUNCTION vs PROCEDURE : Function returns a value and the program uses the
returned value for computation while Procedure
                  doesn't return anything, it performs an operation.

- Procedures are always created even if errors are there but with an error
message.
- SHOW ERRORS command is used to see the errors.
- Source code of procedures and functions can be seen by using the command
"USER_SOURCE"
- select text from user_source where name='procedure_name or function_name'

----------
COMMANDS :
----------

1. CREATE PROCEDURE : To create a procedure
2. EXECUTE      : To call a procedure with its name
3. OR REPLACE         : Replaces the procedure if one exists with the same name

-----------------------------
CREATING A STORED PROCEDURE :
-----------------------------

CREATE OR REPLACE PROCEDURE procedure_name (parameters)
IS | AS
BEGIN
      insert into table_name(parameters);
      commits;
END;

----------------------------
CREATING A STORED FUNCTION :
----------------------------

CREATE OR REPLACE FUNCTION function_name (parameters)
RETURN datatype
IS | AS
BEGIN
      executable statements;
      RETURN value;
END;

--------------
RECOMPILING :
--------------
Oracle automatically compiles the invalid procedures and functions before
execution.

- To explicitly recompile the invalid procedures ot functions : ALTER PROCEDURE
procedure_name COMPILE;

- To see the status(valid/invalid) of a procedure : select status from
user_objects where object_name='procedure_name';

------------
PARAMETERS :      Two types - FORMAL and ACTUAL
------------
FORMAL - parameters declared in defining the procedure
ACTUAL - parameters passed while calling the procedure

----------------
PARAMTERS MODE :   Three types - IN, OUT and IN OUT
----------------

More Related Content

What's hot (15)

PPT
R12 d49656 gc10-apps dba 23
zeesniper
 
ODP
Mysqlppt
poornima sugumaran
 
RTF
Trigger and cursor program using sql
Sushil Mishra
 
PDF
Some tips to improve developer experience with Symfony
tyomo4ka
 
PDF
PL/SQL TRIGGERS
Lakshman Basnet
 
PPT
Oracle Database Trigger
Eryk Budi Pratama
 
PPTX
ORACLE PL SQL FOR BEGINNERS
mohdoracle
 
PPTX
PowerShell Fundamentals
mozdzen
 
PPT
Oracle query optimizer
Smitha Padmanabhan
 
PPT
Performance Instrumentation for PL/SQL: When, Why, How
Karen Morton
 
PPTX
Sql Functions And Procedures
DataminingTools Inc
 
PPTX
Procedures and triggers in SQL
Vikash Sharma
 
PPTX
Oracle: Cursors
DataminingTools Inc
 
PPTX
PL-SQL DIFFERENT PROGRAMS
raj upadhyay
 
PPT
R12 d49656 gc10-apps dba 13
zeesniper
 
R12 d49656 gc10-apps dba 23
zeesniper
 
Trigger and cursor program using sql
Sushil Mishra
 
Some tips to improve developer experience with Symfony
tyomo4ka
 
PL/SQL TRIGGERS
Lakshman Basnet
 
Oracle Database Trigger
Eryk Budi Pratama
 
ORACLE PL SQL FOR BEGINNERS
mohdoracle
 
PowerShell Fundamentals
mozdzen
 
Oracle query optimizer
Smitha Padmanabhan
 
Performance Instrumentation for PL/SQL: When, Why, How
Karen Morton
 
Sql Functions And Procedures
DataminingTools Inc
 
Procedures and triggers in SQL
Vikash Sharma
 
Oracle: Cursors
DataminingTools Inc
 
PL-SQL DIFFERENT PROGRAMS
raj upadhyay
 
R12 d49656 gc10-apps dba 13
zeesniper
 

Viewers also liked (7)

PDF
Snack5! Jump higher, run faster, grow bigger!
BeHappyMum
 
PPT
Recent SLS presentation
Ben Gurion University of the Negev
 
PDF
Ntutm casino
Sophia Wu
 
DOCX
Reflective journal unit 2A
Lucía Conde Cambelo
 
PDF
Policy Practice2007
euwebtc01
 
PPTX
Casino
nashaustin
 
PPTX
Update 3
JusStSaN
 
Snack5! Jump higher, run faster, grow bigger!
BeHappyMum
 
Recent SLS presentation
Ben Gurion University of the Negev
 
Ntutm casino
Sophia Wu
 
Reflective journal unit 2A
Lucía Conde Cambelo
 
Policy Practice2007
euwebtc01
 
Casino
nashaustin
 
Update 3
JusStSaN
 
Ad

Similar to Sql procedures (20)

PPTX
Oracle: Procedures
oracle content
 
PDF
SQL Procedures & Functions
JeevananthamArumugam
 
PDF
Lecture Notes Unit5 chapter17 Stored procedures and functions
Murugan146644
 
PPTX
pl/sql Procedure
Pooja Dixit
 
PPTX
Functions
biplob04
 
PPTX
Procedure and Functions in pl/sql
Ñirmal Tatiwal
 
PPTX
Procedure n functions
Khadija Parween
 
PPT
05 Creating Stored Procedures
rehaniltifat
 
PPTX
Function & procedure
atishupadhyay
 
PPTX
5. stored procedure and functions
Amrit Kaur
 
PPT
Module04
Sridhar P
 
PPTX
Advance Sql Server Store procedure Presentation
Amin Uddin
 
PPTX
Lecture 3.2_Subprogrammm - Function.pptx
pproychd
 
PPT
plsql les01
sasa_eldoby
 
PPTX
Unit 3
Abha Damani
 
PPTX
Unit 3(rdbms)
Jay Patel
 
PPTX
Unit 3(rdbms)
Jay Patel
 
PPTX
9. DBMS Experiment Laboratory PresentationPPT
TheVerse1
 
PPTX
Sql storeprocedure
ftz 420
 
PPTX
Stored procedures
MuksNoor
 
Oracle: Procedures
oracle content
 
SQL Procedures & Functions
JeevananthamArumugam
 
Lecture Notes Unit5 chapter17 Stored procedures and functions
Murugan146644
 
pl/sql Procedure
Pooja Dixit
 
Functions
biplob04
 
Procedure and Functions in pl/sql
Ñirmal Tatiwal
 
Procedure n functions
Khadija Parween
 
05 Creating Stored Procedures
rehaniltifat
 
Function & procedure
atishupadhyay
 
5. stored procedure and functions
Amrit Kaur
 
Module04
Sridhar P
 
Advance Sql Server Store procedure Presentation
Amin Uddin
 
Lecture 3.2_Subprogrammm - Function.pptx
pproychd
 
plsql les01
sasa_eldoby
 
Unit 3
Abha Damani
 
Unit 3(rdbms)
Jay Patel
 
Unit 3(rdbms)
Jay Patel
 
9. DBMS Experiment Laboratory PresentationPPT
TheVerse1
 
Sql storeprocedure
ftz 420
 
Stored procedures
MuksNoor
 
Ad

Recently uploaded (20)

PPTX
Top 10 AI Tools, Like ChatGPT. You Must Learn In 2025
Digilearnings
 
PDF
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PDF
Tips for Writing the Research Title with Examples
Thelma Villaflores
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPTX
Applied-Statistics-1.pptx hardiba zalaaa
hardizala899
 
PDF
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PPTX
I INCLUDED THIS TOPIC IS INTELLIGENCE DEFINITION, MEANING, INDIVIDUAL DIFFERE...
parmarjuli1412
 
PPTX
LDP-2 UNIT 4 Presentation for practical.pptx
abhaypanchal2525
 
PPTX
Electrophysiology_of_Heart. Electrophysiology studies in Cardiovascular syste...
Rajshri Ghogare
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PPTX
The Future of Artificial Intelligence Opportunities and Risks Ahead
vaghelajayendra784
 
PPTX
ENGLISH 8 WEEK 3 Q1 - Analyzing the linguistic, historical, andor biographica...
OliverOllet
 
PPTX
Unlock the Power of Cursor AI: MuleSoft Integrations
Veera Pallapu
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
DOCX
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
Top 10 AI Tools, Like ChatGPT. You Must Learn In 2025
Digilearnings
 
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Tips for Writing the Research Title with Examples
Thelma Villaflores
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
Applied-Statistics-1.pptx hardiba zalaaa
hardizala899
 
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
I INCLUDED THIS TOPIC IS INTELLIGENCE DEFINITION, MEANING, INDIVIDUAL DIFFERE...
parmarjuli1412
 
LDP-2 UNIT 4 Presentation for practical.pptx
abhaypanchal2525
 
Electrophysiology_of_Heart. Electrophysiology studies in Cardiovascular syste...
Rajshri Ghogare
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
The Future of Artificial Intelligence Opportunities and Risks Ahead
vaghelajayendra784
 
ENGLISH 8 WEEK 3 Q1 - Analyzing the linguistic, historical, andor biographica...
OliverOllet
 
Unlock the Power of Cursor AI: MuleSoft Integrations
Veera Pallapu
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 

Sql procedures

  • 1. PROCEDURE : Stored Procedures and Anonymous(External) Procedures FUNCTION vs PROCEDURE : Function returns a value and the program uses the returned value for computation while Procedure doesn't return anything, it performs an operation. - Procedures are always created even if errors are there but with an error message. - SHOW ERRORS command is used to see the errors. - Source code of procedures and functions can be seen by using the command "USER_SOURCE" - select text from user_source where name='procedure_name or function_name' ---------- COMMANDS : ---------- 1. CREATE PROCEDURE : To create a procedure 2. EXECUTE : To call a procedure with its name 3. OR REPLACE : Replaces the procedure if one exists with the same name ----------------------------- CREATING A STORED PROCEDURE : ----------------------------- CREATE OR REPLACE PROCEDURE procedure_name (parameters) IS | AS BEGIN insert into table_name(parameters); commits; END; ---------------------------- CREATING A STORED FUNCTION : ---------------------------- CREATE OR REPLACE FUNCTION function_name (parameters) RETURN datatype IS | AS BEGIN executable statements; RETURN value; END; -------------- RECOMPILING : -------------- Oracle automatically compiles the invalid procedures and functions before execution. - To explicitly recompile the invalid procedures ot functions : ALTER PROCEDURE procedure_name COMPILE; - To see the status(valid/invalid) of a procedure : select status from user_objects where object_name='procedure_name'; ------------ PARAMETERS : Two types - FORMAL and ACTUAL ------------ FORMAL - parameters declared in defining the procedure ACTUAL - parameters passed while calling the procedure ---------------- PARAMTERS MODE : Three types - IN, OUT and IN OUT