Home > Store

Oracle PL/SQL by Example, 6th Edition

eBook

  • Your Price: $53.59
  • List Price: $66.99
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Acrobat® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

Also available in other formats.

Register your product to gain access to bonus material or receive a coupon.

Description

  • Copyright 2023
  • Edition: 6th
  • eBook
  • ISBN-10: 0-13-806287-0
  • ISBN-13: 978-0-13-806287-3

Using PL/SQL for Oracle Database 21c, you can build solutions that deliver unprecedented performance and efficiency in any environment, including the cloud. Oracle PL/SQL by Example, Sixth Edition, teaches all the PL/SQL skills you'll need, through real-world labs and extensive examples. Now fully updated for the newest version of PL/SQL 21c, it covers everything from basic syntax and program control through the latest optimization and tuning enhancements.

Step by step, you'll walk through every key task, mastering today's most valuable Oracle 21c PL/SQL programming techniques on your own. Start by downloading the supporting schema and exercises from informit.com/title/9780138062835. Once you've done an exercise, the author doesn't just present the answer: She offers an in-depth discussion introducing deeper insights and modern best practices.

This book's approach fully reflects the author's award-winning experience teaching PL/SQL to professionals at Columbia University in New York City. New database developers and DBAs can use it to get productive fast; experienced PL/SQL programmers will find it to be a superb Oracle Database 21c solutions reference.

New in This Edition

  • Updated code examples throughout
  • New iteration controls for the FOR LOOP statement, such as stepped range, multiple iterations, collection, and cursor iterations
  • Enhancements for PL/SQL qualified expressions
  • Performance enhancements for PL/SQL functions, such as SQL macro, and better control of the result cache

Other Topics Covered

  • Mastering basic PL/SQL concepts and language fundamentals, and understanding SQL's role in PL/SQL
  • Using conditional and iterative program controls
  • Efficiently handling errors and exceptions
  • Working with cursors and triggers, including compound triggers
  • Using stored procedures, functions, and packages to write modular code that other programs can run
  • Working with collections, object-relational features, native dynamic SQL, bulk SQL, and other advanced features

Downloads

Downloads

Please register your book to gain access to the downloadable exercise files.

Sample Content

Table of Contents

Preface xvii
Introduction to PL/SQL New Features in Oracle 21c xxiii
Chapter 1 PL/SQL Concepts 1
Lab 1.1: PL/SQL Architecture 2
    PL/SQL Architecture 2
    PL/SQL Block Structure 5
    How PL/SQL Gets Executed 9
Lab 1.2: PL/SQL Development Environment 10
    Getting Started with SQL Developer 10
    Getting Started with SQL*Plus 13
    Executing PL/SQL Scripts 14
Lab 1.3: PL/SQL: The Basics 18
    DBMS_OUTPUT.PUT_LINE Statement 18
    Substitution Variable Feature 21
Summary 25
Chapter 2 PL/SQL Language Fundamentals 27
Lab 2.1: PL/SQL Language Components 27
    PL/SQL Variables 29
    PL/SQL Reserved Words 31
    Delimiters 32
    Literals in PL/SQL 33
Lab 2.2: Anchored Data Types 33
Lab 2.3: Scope of a Variable, Block, Nested Blocks, and Labels 35
    Scope of a Variable 35
    Nested Blocks and Labels 36
Summary 38
Chapter 3 SQL in PL/SQL 39
Lab 3.1: SQL Statements in PL/SQL 39
    Initializing Variables with the SELECT INTO Statement 40
    Using DML Statements in a PL/SQL Block 41
    Using a Sequence in a PL/SQL Block 43
Lab 3.2: Transaction Control in PL/SQL 44
    The COMMIT, ROLLBACK, and SAVEPOINT Statements 44
    The SET TRANSACTION Statement 47
Summary 48
Chapter 4 Conditional Control: IF Statements 49
Lab 4.1: IF Statements 50
    IF-THEN Statements 50
    IF-THEN-ELSE Statements 52
Lab 4.2: ELSIF Statements 55
Lab 4.3: Nested IF Statements 59
    Logical Operators 61
Summary 62
Chapter 5 Conditional Control: CASE Statements 65
Lab 5.1: CASE Statements 65
    CASE Statements 66
    Searched CASE Statements 68
Lab 5.2: CASE Expressions 74
Lab 5.3: NULLIF and COALESCE Functions 78
    NULLIF Function 78
    COALESCE Function 80
Summary 82
Chapter 6 Iterative Control: Part I 85
Lab 6.1: Simple Loops 86
    EXIT Statement 87
    EXIT WHEN Statement 91
Lab 6.2: WHILE Loops 92
    Using WHILE Loops 92
    Terminating the WHILE Loop Prematurely 95
Lab 6.3: Numeric FOR Loops 97
    Using the IN Option in the Loop 100
    Using the REVERSE Option in the Loop 103
    Using Iteration Controls in the Loop 104
    Terminating the Numeric FOR Loop Prematurely 108
Summary 109
Chapter 7 Iterative Control: Part II 111
Lab 7.1: CONTINUE Statement 111
    Using the CONTINUE Statement 112
    Using the CONTINUE WHEN Statement 116
Lab 7.2: Nested Loops 119
    Using Nested Loops 119
    Using Loop Labels 120
Summary 122
Chapter 8 Error Handling and Built-in Exceptions 125
Lab 8.1: Handling Errors 125
Lab 8.2: Built-in Exceptions 128
Summary 133
Chapter 9 Exceptions 135
Lab 9.1: Exception Scope 135
Lab 9.2: User-Defined Exceptions 139
Lab 9.3: Exception Propagation 143
    Re-raising Exceptions 148
Summary 149
Chapter 10 Exceptions: Advanced Concepts 151
Lab 10.1: RAISE_APPLICATION_ERROR 151
Lab 10.2: EXCEPTION_INIT Pragma 155
Lab 10.3: SQLCODE and SQLERRM 157
Summary 160
Chapter 11 Introduction to Cursors 161
Lab 11.1: Types of Cursors 162
    Implicit Cursor 162
    Explicit Cursor 164
Lab 11.2: Table-Based and Cursor-Based Records 171
    Table-Based Records 172
    Cursor-Based Records 174
Lab 11.3: Cursor FOR Loops 175
Lab 11.4: Nested Cursors 177
Summary 179
Chapter 12 Advanced Cursors 181
Lab 12.1: Parameterized Cursors 181
Lab 12.2: Cursor Variables and Expressions 186
    Cursor Variables 187
    Cursor Expressions 193
Lab 12.3: FOR UPDATE Cursors 196
Summary 199
Chapter 13 Triggers 201
Lab 13.1: What Triggers Are 201
    Database Trigger 202
    BEFORE Triggers 205
    AFTER Triggers 210
    Autonomous Transaction 211
Lab 13.2: Types of Triggers 213
    Row and Statement Triggers 213
    INSTEAD OF Triggers 215
Summary 219
Chapter 14 Mutating Tables and Compound Triggers 221
Lab 14.1: Mutating Tables 221
Lab 14.2: Compound Triggers 223
Summary 228
Chapter 15 Collections 229
Lab 15.1: PL/SQL Tables 230
    Associative Arrays 231
    Nested Tables 233
    Collection Methods 236
Lab 15.2: Varrays 240
Lab 15.3: Multidimensional Collections 245
Lab 15.4: Collection Iteration Controls and
    Qualified Expressions 247
    Collection Iteration Controls 247
    Qualified Expressions 251
Summary 258
Chapter 16 Records 259
Lab 16.1: User-Defined Records 259
    User-Defined Records 260
    Qualified Expressions with Records 262
    Record Compatibility 263
Lab 16.2: Nested Records 265
Lab 16.3: Collections of Records 268
Summary 271
Chapter 17 Native Dynamic SQL 273
Lab 17.1: EXECUTE IMMEDIATE Statements 274
    EXECUTE IMMEDIATE Statement 275
Lab 17.2: OPEN FOR, FETCH, and CLOSE Statements 283
Summary 287
Chapter 18 Bulk SQL 289
Lab 18.1: FORALL Statements 290
    FORALL Statements 290
    SAVE EXCEPTIONS Option 294
    INDICES OF Option 296
    VALUES OF Option 297
Lab 18.2: The BULK COLLECT Clause 299
Lab 18.3: Binding Collections in SQL Statements 308
    Binding Collections with EXECUTE IMMEDIATE Statements 308
    Binding Collections with OPEN FOR, FETCH, and CLOSE Statements 314
Summary 318
Chapter 19 Procedures 319
Lab 19.1: Creating Nested Procedures 320
    Nested Procedures 320
    Parameter Modes 321
    Forward Declaration 326
Lab 19.2: Creating Stand-Alone Procedures 327
Summary 330
Chapter 20 Functions 331
Lab 20.1: Creating Nested Functions 331
Lab 20.2: Creating Stand-Alone Functions 336
Summary 340
Chapter 21 Packages 341
Lab 21.1: Creating Packages 341
    Creating a Package Specification 342
    Creating a Package Body 343
Lab 21.2: Package Instantiation and Initialization 348
    Package Instantiation and Initialization 349
    Package State 351
    Lab 21.3: SERIALLY_REUSABLE Packages 351
Summary 356
Chapter 22 Stored Code Advanced Concepts 357
Lab 22.1: Subprogram Overloading 357
Lab 22.2: Result-Cached Functions 363
Lab 22.3: Invoking PL/SQL Functions from SQL Statements 366
    Invoking Functions in SQL Statements 367
    Using Pipelined Table Functions 368
    Using SQL Macros 370
Summary 375
Chapter 23 Object Types in Oracle 379
Lab 23.1: Object Types 380
    Creating Object Types 381
    Using Object Types with Collections 385
Lab 23.2: Object Type Methods 388
    Using Constructor Methods 389
    Using Member Methods 392
    Using Static Methods 393
    Comparing Objects 393
Summary 398
Chapter 24 Storing Object Types in Tables 399
Lab 24.1: Storing Object Types in Relational Tables 400
Lab 24.2: Storing Object Types in Object Tables 403
Lab 24.3: Type Evolution 405
Summary 410
Chapter 25 Dynamic SQL with the DBMS_SQL Package 411
Lab 25.1: Generating Dynamic SQL with the DBMS_SQL Package 412
Summary 420
Appendix A PL/SQL Formatting Guide 421
Case 421
Whitespace 421
Naming Conventions 422
Comments 423
Appendix B Student Database Schema 425
Table and Column Descriptions 425


9780138062835    TOC    4/20/2023

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020