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

Manual Experiment 1.3

The document introduces PL/SQL, a procedural extension of SQL developed by Oracle to enhance SQL capabilities. It outlines the structure of a PL/SQL block, which includes the Declaration, Execution, and Exception sections, and provides an example of a simple PL/SQL program. The document emphasizes the importance of semicolons at the end of statements and the ability to nest PL/SQL blocks.

Uploaded by

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

Manual Experiment 1.3

The document introduces PL/SQL, a procedural extension of SQL developed by Oracle to enhance SQL capabilities. It outlines the structure of a PL/SQL block, which includes the Declaration, Execution, and Exception sections, and provides an example of a simple PL/SQL program. The document emphasizes the importance of semicolons at the end of statements and the ability to nest PL/SQL blocks.

Uploaded by

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

Experiment: 1.

AIM: Introduction and implementation of programs using Block Structure and


variables.
S/W Requirement: Oracle Database Express Edition

Practical: Introduction to PL/SQL


o PL/SQL stands for Procedural Language extension of SQL.
o PL/SQL is a combination of SQL along with the procedural features of programming
languages.
o It was developed by Oracle Corporation in the early 90’s to enhance the capabilities
of SQL.

The PL/SQL Engine:


Oracle uses a PL/SQL engine to processes the PL/SQL statements. A PL/SQL code can be
stored in the client system (client-side) or in the database (server-side).

A Simple PL/SQL Block:


DECLARE
Variable declaration
BEGIN
Program Execution
EXCEPTION
Exception handling
END;

Declaration Section:
The Declaration section of a PL/SQL Block starts with the reserved keyword DECLARE.
This section is optional and is used to declare any placeholders like variables, constants,
records and cursors, which are used to manipulate data in the execution section.

Execution Section:
The Execution section of a PL/SQL Block starts with the reserved keyword BEGIN and ends
with END. This is a mandatory section and is the section where the program logic is written
to perform any task. The programmatic constructs like loops, conditional statement and SQL
statements form the part of execution section.

Exception Section:
The Exception section of a PL/SQL Block starts with the reserved keyword EXCEPTION.
This section is optional. Any errors in the program can be handled in this section, so that the
PL/SQL Blocks terminates gracefully. If the PL/SQL Block contains exceptions that cannot
be handled, the Block terminates abruptly with errors.

Every statement in the above three sections must end with a semicolon ; . PL/SQL blocks can
be nested within other PL/SQL blocks. Comments can be used to document code.

SQL> SET SERVEROUTPUT ON;


SQL> DECLARE

--I am a comment, so i will be ignored.


var varchar2(40) := 'Chandigarh University' ;

BEGIN
dbms_output.put_line(var);

END;
/
Output:

Chandigarh University

PL/SQL procedure successfully completed.

You might also like