0% found this document useful (0 votes)
96 views

Program With PL/SQL

The document provides an overview and introduction to programming with PL/SQL. It covers topics such as PL/SQL fundamentals, datatypes, control structures, collections and records, interaction with Oracle databases, error handling, subprograms, packages, object types, dynamic SQL, and tuning PL/SQL applications. The document contains sections on various PL/SQL concepts, features, and language elements.

Uploaded by

Rakesh Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views

Program With PL/SQL

The document provides an overview and introduction to programming with PL/SQL. It covers topics such as PL/SQL fundamentals, datatypes, control structures, collections and records, interaction with Oracle databases, error handling, subprograms, packages, object types, dynamic SQL, and tuning PL/SQL applications. The document contains sections on various PL/SQL concepts, features, and language elements.

Uploaded by

Rakesh Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Program with PL/SQL

Multisoft Systems B - 125, Sector 2, Noida 201301, Uttar Pradesh, India M: 9810306956, T: (+91) 120 2540300/400, 4333774 E: [email protected]

Program with PL/SQL


1 Overview of PL/SQL 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.20 1.21 1.22 Understanding the Main Features of PL/SQL Block Structure Variables and Constants Cursors Cursor FOR Loops Cursor Variables Attributes Control Structures Modularity Data Abstraction Information Hiding Error Handling PL/SQL Architecture In the Oracle Database Server In Oracle Tools Advantages of PL/SQL Support for SQL Support for Object-Oriented Programming Better Performance Full Portability Tight Integration with SQL Tight Security

Fundamentals of PL/SQL 2.1 2.2 2.3 2.4 2.5 Character Set Lexical Units Delimiters, Identifiers, Literals, Comments, Declarations Using DEFAULT Using NOT NULL

Multisoft Systems B - 125, Sector 2, Noida 201301, Uttar Pradesh, India M: 9810306956, T: (+91) 120 2540300/400, 4333774 E: [email protected]

2.6 2.7 2.8 2.9 2.10 2.11 2.12

Using %TYPE, %ROWTYPE Restrictions on Declarations PL/SQL Naming Conventions PL/SQL Expressions and Comparisons Logical Operators, Boolean Expressions, CASE Expressions Handling Null Values in Comparisons and Conditional Statements Built-In Functions

PL/SQL Datatypes 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 Predefined Datatypes Number and Character Types LOB Types Boolean Type Datetime and Interval Types Datetime and Interval Arithmetic User-Defined Subtypes Datatype Conversion Explicit vs. Implicit Conversion DATE Values RAW and LONG RAW Values

PL/SQL Control Structures 4.1 4.2 4.3 4.4 4.5 4.6 Overview of PL/SQL Control Structures Conditional Control: IF and CASE Statements Iterative Control: LOOP and EXIT Statements Sequential Control: GOTO and NULL Statements GOTO Statement NULL Statement

PL/SQL Collections and Records 5.1 5.2 5.3 What Is a Collection? Nested Tables and Varrays Choosing Which PL/SQL Collection Types to Use

Multisoft Systems B - 125, Sector 2, Noida 201301, Uttar Pradesh, India M: 9810306956, T: (+91) 120 2540300/400, 4333774 E: [email protected]

5.4 5.5 5.6 5.7 5.8 5.9 5.10 5.11 5.12 5.13 5.14 5.15 5.16 5.17 5.18 5.19

Defining Collection Types Initializing and Referencing Collections Assigning Collections Comparing Collections Applying Methods to Collection Parameters Reducing Loop Overhead for Collections with Bulk Binds Using the FORALL Statement Using FORALL and BULK COLLECT Together What Is a Record? Defining and Declaring Records Referencing Records Assigning Null Values to Records Assigning, Comparing and Manipulating Records Inserting PL/SQL Records into the Database Updating the Database with PL/SQL Record Values Querying Data into Collections of Records

Interaction between PL/SQL and Oracle 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 6.10 6.11 6.12 6.13 6.14 6.15 6.16 Overview of SQL Support in PL/SQL Data Manipulation Transaction Control SQL Functions, Pseudocolumns and Operators Managing Cursors Overview of Explicit and Implicit Cursors Separating Cursor Specs and Bodies with Packages Using Cursor FOR Loops Defining Aliases for Expression Values in a Cursor FOR Loop Passing Parameters to a Cursor FOR Loop Using Cursor Variables Defining REF CURSOR Types Controlling Cursor Variables Reducing Network Traffic When Passing Host Cursor Variables to PL/SQL Restrictions on Cursor Variables Using Cursor Expressions

Multisoft Systems B - 125, Sector 2, Noida 201301, Uttar Pradesh, India M: 9810306956, T: (+91) 120 2540300/400, 4333774 E: [email protected]

6.17 6.18 6.19 6.20 6.21 6.22 6.23

Overview of Transaction Processing in PL/SQL How Transactions Guard Your Database Making Changes Permanent with COMMIT Undoing Changes with ROLLBACK Undoing Partial Changes with SAVEPOINT How Oracle Does Implicit Rollbacks Ending Transactions

Handling PL/SQL Errors 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 7.10 7.11 7.12 7.13 7.14 7.15 7.16 7.17 7.18 7.19 Overview of PL/SQL Error Handling Advantages of PL/SQL Exceptions Predefined PL/SQL Exceptions Defining Your Own PL/SQL Exceptions Declaring PL/SQL Exceptions Associating a PL/SQL Exception with a Number: Pragma EXCEPTION_INIT Defining Your Own Error Messages: Procedure RAISE_APPLICATION_ERROR How PL/SQL Exceptions Are Raised Raising Exceptions with the RAISE Statement How PL/SQL Exceptions Propagate Reraising a PL/SQL Exception Handling Raised PL/SQL Exceptions Handling Exceptions Raised in Declarations Branching to or from an Exception Handler Retrieving the Error Code and Error Message: SQLCODE and SQLERRM Catching Unhandled Exceptions Tips for Handling PL/SQL Errors Continuing after an Exception Is Raised Using Locator Variables to Identify Exception Locations

PL/SQL Subprograms 8.1 8.2 8.3 8.4 What Are Subprograms? Advantages of Subprograms Understanding PL/SQL Procedures Understanding PL/SQL Functions

Multisoft Systems B - 125, Sector 2, Noida 201301, Uttar Pradesh, India M: 9810306956, T: (+91) 120 2540300/400, 4333774 E: [email protected]

8.5 8.6 8.7 8.8 8.9 8.10 8.11 8.12 8.13 8.14 8.15 8.16 8.17 8.18 8.19 8.20 8.21 8.22 8.23 8.24 8.25

Using the RETURN Statement Controlling Side Effects of PL/SQL Subprograms Declaring PL/SQL Subprograms Packaging PL/SQL Subprograms Together Positional Versus Named Notation for Subprogram Parameters Specifying Subprogram Parameter Modes Using the IN Mode Using the OUT Mode Using the IN OUT Mode Summary of Subprogram Parameter Modes How Subprogram Calls Are Resolved How Overloading Works with Inheritance Accepting and Returning Multiple Rows with Table Functions Overview of Table Functions What Are Pipelined Table Functions? Using Pipelined Table Functions for Transformations Optimizing Multiple Calls to Table Functions Handling Exceptions in Table Functions Understanding and Using Recursion Recursion Versus Iteration Creating Dynamic Web Pages with PL/SQL Server Pages

PL/SQL Packages 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 What is PL/SQL Package? Example and Advantages of a PL/SQL Package Understanding The Package Spec Referencing Package Contents Understanding The Package Body Some Examples of Package Features Private Versus Public Items in Packages How Package STANDARD Defines the PL/SQL Environment About the DBMS_ALERT, DBMS_OUTPUT, DBMS_PIPE, UTL_FILE, UTL_HTTP Package 9.10 Guidelines for Writing Packages

Multisoft Systems B - 125, Sector 2, Noida 201301, Uttar Pradesh, India M: 9810306956, T: (+91) 120 2540300/400, 4333774 E: [email protected]

10

PL/SQL Object Types 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 10.10 10.11 10.12 10.13 10.14 10.15 10.16 10.17 The Role of Abstraction What Is an Object Type? Why Use Object Types? Structure of an Object Type Components of an Object Type Attributes Methods Changing Attributes and Methods of an Existing Object Type (Type Evolution) Defining Object Types Declaring and Initializing Objects How PL/SQL Treats Uninitialized Objects Accessing Attributes Defining and Calling Constructors Calling Methods Sharing Objects through the REF Modifier Forward Type Definitions Manipulating, Selecting, Inserting, Updating and Deleting Objects

11

Native Dynamic SQL 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.10 11.11 11.12 11.13 What Is Dynamic SQL? The Need for Dynamic SQL Using the EXECUTE IMMEDIATE Statement Some Examples of Dynamic SQL Backward Compatibility of the USING Clause Specifying Parameter Modes Using the OPEN-FOR, FETCH, and CLOSE Statements Opening the Cursor Variable Fetching from the Cursor Variable Closing the Cursor Variable Examples of Dynamic SQL for Records, Objects, and Collections Using Bulk Dynamic SQL Syntax for Dynamic Bulk Binds

Multisoft Systems B - 125, Sector 2, Noida 201301, Uttar Pradesh, India M: 9810306956, T: (+91) 120 2540300/400, 4333774 E: [email protected]

11.14 11.15 11.16 11.17 11.18 11.19 11.20

Examples of Dynamic Bulk Binds Tips and Traps for Dynamic SQL Improving Performance Making Procedures Work on Arbitrarily Named Schema Objects Using Cursor Attributes Using Pragma RESTRICT_REFERENCES Avoiding Deadlocks

12

Tuning PL/SQL Applications 12.1 12.2 12.3 12.4 12.5 12.6 12.7 12.8 12.9 12.10 12.11 12.12 Reasons for PL/SQL Performance Problems Identifying PL/SQL Performance Problems The Profiler API: Package DBMS_PROFILER The Trace API: Package DBMS_TRACE PL/SQL Features for Performance Tuning Tuning PL/SQL Performance with Native Dynamic SQL Tuning PL/SQL Performance with Bulk Binds Tuning PL/SQL Performance with the NOCOPY Compiler Hint Tuning PL/SQL Performance with the RETURNING Clause Tuning PL/SQL Performance with External Routines Improving PL/SQL Performance with Object Types and Collections Compiling PL/SQL Code for Native Execution

13

PL/SQL Language Elements 13.1 13.2 13.3 13.4 13.5 13.6 13.7 13.8 13.9 13.10 13.11 Assignment Statement AUTONOMOUS_TRANSACTION Pragma Blocks CASE Statement CLOSE Statement Collection Methods Collections Comments COMMIT Statement Constants and Variables Cursor Attributes

Multisoft Systems B - 125, Sector 2, Noida 201301, Uttar Pradesh, India M: 9810306956, T: (+91) 120 2540300/400, 4333774 E: [email protected]

13.12 13.13 13.14 13.15 13.16 13.17 13.18 13.19 13.20 13.21 13.22 13.23 13.24 13.25 13.26 13.27 13.28 13.29 13.30 13.31 13.32 13.33 13.34 13.35 13.36 13.37 13.38 13.39 13.40 13.41 13.42 13.43 13.44 13.45

Cursor Variables Cursors DELETE Statement EXCEPTION_INIT Pragma Exceptions EXIT Statement Expressions FETCH Statement FORALL Statement Functions GOTO Statement IF Statement INSERT Statement Literals OPEN Statement OPEN-FOR Statement OPEN-FOR-USING Statement Packages Procedures RAISE Statement Records RESTRICT_REFERENCES Pragma RETURN Statement ROLLBACK Statement %ROWTYPE Attribute SAVEPOINT Statement SELECT INTO Statement SERIALLY_REUSABLE Pragma SET TRANSACTION Statement SQL Cursor SQLCODE Function SQLERRM Function %TYPE Attribute UPDATE Statement

Multisoft Systems B - 125, Sector 2, Noida 201301, Uttar Pradesh, India M: 9810306956, T: (+91) 120 2540300/400, 4333774 E: [email protected]

You might also like