0% found this document useful (0 votes)
0 views2 pages

Stored Procedures

The document describes the creation and usage of stored procedures in PL/SQL, highlighting their ability to accept parameters and perform specific tasks. It distinguishes between procedures and functions, noting that procedures may not return values directly while functions always do. Additionally, it emphasizes the benefits of reusability and maintainability of procedures within a database context.

Uploaded by

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

Stored Procedures

The document describes the creation and usage of stored procedures in PL/SQL, highlighting their ability to accept parameters and perform specific tasks. It distinguishes between procedures and functions, noting that procedures may not return values directly while functions always do. Additionally, it emphasizes the benefits of reusability and maintainability of procedures within a database context.

Uploaded by

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

CREATE OR REPLACE PROCEDURE P1(A NUMBER)

AS
BEGIN
DBMS_OUTPUT.PUT_LINE('A:'||A);
END P1;
/

DECLARE
BEGIN
P1(100);
END;
/

CREATE OR REPLACE PROCEDURE P2(A IN NUMBER)


AS
BEGIN
DBMS_OUTPUT.PUT_LINE('A:'||A);
END P2;
/

DECLARE X
NUMBER;
BEGIN
X:=10;
DBMS_OUTPUT.PUT_LINE('X:'||X);
P2(X);
DBMS_OUTPUT.PUT_LINE('X:'||X);
END;
/

CREATE OR REPLACE PROCEDURE P3(A OUT NUMBER)


AS
BEGIN
A:=100;
DBMS_OUTPUT.PUT_LINE('A:'|| A);
END P3;
/

DECLARE X
NUMBER;
BEGIN
X:=50;
DBMS_OUTPUT.PUT_LINE('X:'||X);
P3(X);
DBMS_OUTPUT.PUT_LINE('X:'||X);
END;
/

sub program or procedure: to store the procedure inside the database is called
stored procedure.

A block of code is requred to perform a specific operation can be called as a


subprogram or procedure.

for the reuse purpose once created you can call the procedures again and again as
per your requirement.

functions are also block of code or sub programmes.


functions are always supposed to return a values but procedure may or may not
return a value.

second thing procedures are always return a values with the help of parameters only
means with the
help of out or in out parameter but functions are returning a value with the help
of return keyword and a
return variable.

A procedure is mainly used to perform one or more specific task.

a procedure is a named pl/sql block that can accept parameters can be invoked.

a procedure can be compiled and stored in the database as a schema object.

it promote reusability and maintainability.

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