PL/SQL
PL/SQL is Oracle’s procedural language extension to SQL. PL/SQL allows you
to mix SQL statements with procedural st...
Anonymous block:
This is a PL/SQL block that appears within your application. In many
applications PL/SQL blocks can appea...
PL/SQL Engine
Every PL/SQL block is first executed by PL/SQL engine.
This is the engine that compiles and executes PL/SQL ...
PL/SQL Engine
Features of PL/SQL
Block structure
PL/SQL is a block-structured language. Each program written in PL/SQL is
written as a b...
Features of PL/SQL
Control structures
PL/SQL allows control structures like IF statement, FOR loop, WHILE
loop to be used ...
Features of PL/SQL
Modularity
PL/SQL allows process to be divided into different modules. Subprograms
called as procedures...
Features of PL/SQL
Cursors
A cursor is a private SQL area used to execute SQL statements and store
processing information....
Advantages Of PL/SQL
Support for SQL
PL/SQL allows you to use SQL commands, function and operators. PL/SQL
supports data t...
Advantages Of PL/SQL
Better performance
PL/SQL block is sent as one unit to Oracle server. Without PL/SQL each SQL
command...
PL/SQL block
PL/SQL programs are written as blocks. Block allows you to group
logically related statements and declaration...
PL/SQL block
Syntax of PL/SQL block:
[DECLARE
declaration of variable
declaration of cursor
declaration of exception ]
BEG...
PL/SQL block
Declarative Part
This is the area of the block where variables, cursors etc are declared. All variables
used ...
PL/SQL Data Types
• Scalar -Represents a single value
NUMBER, CHAR, VARCHAR2, DATE, BOOLEAN
• Composite -Is a collection o...
Exception’s
In PL/SQL, errors and warnings are called as exceptions. Whenever
a predefined error occurs in the program, PL...
cursor
Oracle uses a work area to execute SQL commands and store
processing information. PL/SQL allows you to access this ...
Cursor
Implicit Cursor:
PL/SQL declares an implicit cursor for every DML command, and
queries that return a single row. Th...
Stored Procedure
A stored procedure is a PL/SQL block that is stored in the database
with a name. It is invoked using the ...
Stored Procedure
Advantages of stored procedures
•Reduced network traffic
•Better Performance
•Easy Maintenance
•Security
Triggers
Database trigger is a PL/SQL block that is executed on an event in the
database. The event is related to a partic...
Triggers
Statement-level Triggers:
A statement trigger is fired only for once for a DML statement
irrespective of the numb...
Triggers
Row-level Trigger:
A row trigger is fired once for each row that is affected by DML
command. For example, if an U...
Triggers
Before Triggers:
While defining a trigger, you can specify whether the trigger is to be fired
before the command ...
Triggers
AFTER Triggers:
After triggers are fired after the triggering action is completed.
For example, If after trigger ...
Call / Whatsapp: +91- 9100 77 3003 / 3002
E-mail: info@unitedtrainings.com
Course content: click on the below link
http://...
Oracle PL/SQL online training | PL/SQL online Training
Oracle PL/SQL online training | PL/SQL online Training
Upcoming SlideShare
Loading in …5
×

Oracle PL/SQL online training | PL/SQL online Training

1,620 views
1,492 views

Published on

Oracle PL/SQL Online Training by United Training's.
http://unitedtrainings.com/plsql-online-training/
Whatsapp:- +91 - 9100 77 3003/ 3002, Email: info@unitedtrainings.com

pl/sql online training,oracle pl/sql online training,pl/sql training,pl/sql training videos,
pl/sql online training in Hyderabad,pl/sql training online,pl/sql online course,
pl/sql training pune,pl/sql interview questions,pl/sql training in Bangalore

Published in: Education, Travel, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,620
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
114
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Oracle PL/SQL online training | PL/SQL online Training

  1. 1. PL/SQL PL/SQL is Oracle’s procedural language extension to SQL. PL/SQL allows you to mix SQL statements with procedural statements like IF statement, Looping structures etc. PL/SQL is the superset of SQL. It uses SQL for data retrieval and manipulation and uses its own statements for data processing. PL/SQL program units are generally categorized as follows: 1. Anonymous blocks 2. Stored procedures
  2. 2. Anonymous block: This is a PL/SQL block that appears within your application. In many applications PL/SQL blocks can appear where SQL statements can appear. Such blocks are called as Anonymous blocks. Stored Procedure: This is a PL/SQL block that is stored in the database with a name. Application programs can execute these procedures using the name. Oracle also allows you to create functions, which are same as procedures but return a value, and packages, which are a collection of procedures and functions.
  3. 3. PL/SQL Engine Every PL/SQL block is first executed by PL/SQL engine. This is the engine that compiles and executes PL/SQL blocks. PL/SQL engine is available in Oracle Server and certain Oracle tools such as Oracle Forms and Oracle Reports. PL/SQL engine executes all procedural statements of a PL/SQL of the block, but sends SQL command to SQL statements executor in the Oracle RDBMS. That means PL/SQL separates SQL commands from PL/SQL commands and executes PL/SQL commands using Procedural statement executor, which is a part of PL/SQL.
  4. 4. PL/SQL Engine
  5. 5. Features of PL/SQL Block structure PL/SQL is a block-structured language. Each program written in PL/SQL is written as a block. Blocks can also be nested. Each block is meant for a particular task. Variables and constants PL/SQL allows you to declare variables and constants. Variables are used to store values temporarily. Variables and constants can be used in SQL and PL/SQL procedural statements just like an expression.
  6. 6. Features of PL/SQL Control structures PL/SQL allows control structures like IF statement, FOR loop, WHILE loop to be used in the block. Control structures are most important extension to SQL in PL/SQL. Control structures allow any data process possible in PL/SQL. Exception handling PL/SQL allows errors, called as exceptions, to be detected and handled. Whenever there is a predefined error PL/SQL raises an exception automatically. These exceptions can be handled to recover from errors.
  7. 7. Features of PL/SQL Modularity PL/SQL allows process to be divided into different modules. Subprograms called as procedures and functions can be defined and invoked using the name. These subprograms can also take parameters. Built-in functions Most of the SQL functions that we have seen so far in SQL are available in PL/SQL. These functions can be used to manipulate variables of PL/SQL.
  8. 8. Features of PL/SQL Cursors A cursor is a private SQL area used to execute SQL statements and store processing information. PL/SQL implicitly uses cursors for all DML commands and SELECT command that returns only one row. And it also allows you to define explicit cursor to deal with multiple row queries.
  9. 9. Advantages Of PL/SQL Support for SQL PL/SQL allows you to use SQL commands, function and operators. PL/SQL supports data types of SQL. PL/SQL also allows SQL statements to be constructed and executed on the fly. The process of creating SQL statements on the fly is called as Dynamic SQL. This is different from writing SQL commands at the time of writing the program, which is called as Static SQL. Starting from Oracle8i, PL/SQL support native dynamic SQL, which makes programming Dynamic SQL easier than its predecessor, where we used DBMS_SQL package.
  10. 10. Advantages Of PL/SQL Better performance PL/SQL block is sent as one unit to Oracle server. Without PL/SQL each SQL command is to be passed to Oracle server, which will increase network traffic heavily. As a collection of SQL statements is passed as a block to Oracle server, it improves performance. Portability Applications written in PL/SQL are portable to any platform on which Oracle runs. Once you write a program in PL/SQL, it can be used in any environment without any change at all.
  11. 11. PL/SQL block PL/SQL programs are written as blocks. Block allows you to group logically related statements and declarations. PL/SQL block is consisting of the following three parts: Declarative part Executable part Exception-handling part
  12. 12. PL/SQL block Syntax of PL/SQL block: [DECLARE declaration of variable declaration of cursor declaration of exception ] BEGIN executable commands [EXCEPTION exception handlers] END;
  13. 13. PL/SQL block Declarative Part This is the area of the block where variables, cursors etc are declared. All variables used in the block are to be declared in declarative part. Executable part Is the area where we write SQL and PL/SQL commands that are to be executed. This is the only mandatory part of the entire block. Exception-handling part Is the place where we handle exceptions (errors) that are raised in executable part. Exception handlers handle exceptions. We will discuss more about this in later chapter.
  14. 14. PL/SQL Data Types • Scalar -Represents a single value NUMBER, CHAR, VARCHAR2, DATE, BOOLEAN • Composite -Is a collection of components RECORD, TABLE and VARRAY • Reference -Is a pointer that points to another item REF CURSOR, REF Object_type • LOB -Holds a lob locator BFILE, BLOB, CLOB, and NCLOB
  15. 15. Exception’s In PL/SQL, errors and warnings are called as exceptions. Whenever a predefined error occurs in the program, PL/SQL raises an exception. For example, if you try to divide a number by zero then PL/SQL raises an exception called ZERO_DIVIDE and if SELECT can not find a record then PL/SQL raises exception NO_DATA_FOUND. PL/SQL has a collection of predefined exceptions. Each exception has a name. These exceptions are automatically raised by PL/SQL whenever the corresponding error occurs
  16. 16. cursor Oracle uses a work area to execute SQL commands and store processing information. PL/SQL allows you to access this area through a name using a cursor. Implicit cursor Explicit cursor
  17. 17. Cursor Implicit Cursor: PL/SQL declares an implicit cursor for every DML command, and queries that return a single row. The name of the implicit cursor is SQL. You can directly use this cursor without any declaration. Explicit Cursor: PL/SQL‟s implicit cursor can handle only single-row queries. If you ever need to select more than one row using SELECT in PL/SQL then you have to use explicit cursor
  18. 18. Stored Procedure A stored procedure is a PL/SQL block that is stored in the database with a name. It is invoked using the name. Each procedure is meant for a specific purpose. A stored procedure is stored in the database as an object. It is also called as database procedure as it is stored in the database. A procedure may take one or more parameters. If a procedure takes parameters then these parameters are to be supplied at the time of calling the procedure.
  19. 19. Stored Procedure Advantages of stored procedures •Reduced network traffic •Better Performance •Easy Maintenance •Security
  20. 20. Triggers Database trigger is a PL/SQL block that is executed on an event in the database. The event is related to a particular data manipulation of a table such as inserting, deleting or updating a row of a table. Types of Triggers •Statement-level trigger •Row-level trigger •Before triggers •After triggers
  21. 21. Triggers Statement-level Triggers: A statement trigger is fired only for once for a DML statement irrespective of the number of rows affected by the statement. Statement-level triggers are typically used to enforce rules that are not related to data. For example, it is possible to implement a rule that says “no body can modify BATCHES table after 9 P.M”. Statement-level trigger is the default type of trigger.
  22. 22. Triggers Row-level Trigger: A row trigger is fired once for each row that is affected by DML command. For example, if an UPDATE command updates 100 rows then row-level trigger is fired 100 times whereas a statement-level trigger is fired only for once. Row-level trigger are used to check for the validity of the data. They are typically used to implement rules that cannot be implemented by integrity constraints.
  23. 23. Triggers Before Triggers: While defining a trigger, you can specify whether the trigger is to be fired before the command (INSERT, DELETE, and UPDATE) is executed or after the command is executed. Before triggers are commonly used to check the validity of the data before the action is performed. For instance, you can use before trigger to prevent deletion of row if deletion should not be allowed in the given case.
  24. 24. Triggers AFTER Triggers: After triggers are fired after the triggering action is completed. For example, If after trigger is associated with INSERT command then it is fired after the row is inserted into the table.
  25. 25. Call / Whatsapp: +91- 9100 77 3003 / 3002 E-mail: info@unitedtrainings.com Course content: click on the below link http://unitedtrainings.com/plsql-online-training/

×