Oracle PL/SQL by Example, 4/e (Paperback)

Benjamin Rosenzweig, Elena Rakhimov

  • 出版商: Prentice Hall
  • 出版日期: 2008-08-01
  • 售價: $2,170
  • 貴賓價: 9.5$2,062
  • 語言: 英文
  • 頁數: 768
  • 裝訂: Paperback
  • ISBN: 0137144229
  • ISBN-13: 9780137144228
  • 相關分類: OracleSQL





This integrated learning solution teaches all the Oracle PL/SQL skills you need, hands-on, through real-world labs, extensive examples, exercises, and projects! Completely updated for Oracle 11g, Oracle PL/SQL by Example, Fourth Edition covers all the fundamentals, from PL/SQL syntax and program control through packages and Oracle 11g’s significantly improved triggers.


One step at a time, you’ll walk through every key task, discovering the most important PL/SQL programming techniques on your own. Building on your hands-on learning, the authors share solutions that offer deeper insights and proven best practices. End-of-chapter projects bring together all the techniques you’ve learned, strengthening your understanding through real-world practice.


This book’s approach fully reflects the authors’ award-winning experience teaching PL/SQL programming to professionals at Columbia University. New database developers and DBAs can use its step-by-step instructions to get productive fast; experienced PL/SQL programmers can use this book as a practical solutions reference. Coverage includes

        • Mastering basic PL/SQL concepts and general programming language fundamentals, and understanding SQL’s role in


        • Using conditional and iterative program control techniques, including the new CONTINUE and CONTINUE WHEN statements

        • Efficiently handling errors and exceptions

        • Working with cursors and triggers, including Oracle 11g’s powerful new compound triggers

        • Using stored procedures, functions, and packages to write modular code that other programs can execute

        • Working with collections, object-relational features, native dynamic SQL, bulk SQL, and other advanced PL/SQL capabilities

        • Handy reference appendices: PL/SQL formatting guide, sample database schema, ANSI SQL standards reference, and



Benjamin Rosenzweig is a Software Development Manager at Misys. Previously he was a Principal Consultant at Oracle. His experience ranges from creating an electronic Tibetan—English Dictionary in Kathmandu, Nepal, to supporting presentation centers at Goldman Sachs and managing trading systems at TIAA-CREF. As an instructor at Columbia University’s Computer Technology and Application Program, he was awarded the Outstanding Teaching Award. Rosenzweig wrote and presented Oracle Forms Developer: The Complete Video Course, and coauthored Oracle Web Application Programming for PL/SQL Developers.


Elena Silvestrova Rakhimov is Senior Developer and Team Lead at Alea Software. She has more than fifteen years of experience in database development in a wide spectrum of enterprise and business environments, ranging from non-profit organizations to Wall Street. She has taught database programming at Columbia University.



Acknowledgments xiv

About the Authors xv

Introduction xvii


CHAPTER 1 PL/SQL Concepts 1

    LAB 1.1 PL/SQL in Client/Server Architecture 2

        1.1.1 Use PL/SQL Anonymous Blocks 8

        1.1.2 Understand How PL/SQL Gets Executed 10

    LAB 1.2 PL/SQL in SQL*Plus 12

        1.2.1 Use Substitution Variables 16

        1.2.2 Use the DBMS_OUTPUT.PUT_LINE Statement 17

Chapter 1 Try It Yourself 19


CHAPTER 2 General Programming Language

Fundamentals 21

    LAB 2.1 PL/SQL Programming Fundamentals 22

        2.1.1 Make Use of PL/SQL Language Components 23

        2.1.2 Make Use of PL/SQL Variables 24

        2.1.3 Handle PL/SQL Reserved Words 26

        2.1.4 Make Use of Identifiers in PL/SQL 27

        2.1.5 Make Use of Anchored Datatypes 28

        2.1.6 Declare and Initialize Variables 31

        2.1.7 Understand the Scope of a Block, Nested Blocks, and Labels 34

Chapter 2 Try It Yourself 37



    LAB 3.1 Making Use of DML in PL/SQL 40

        3.1.1 Use the Select INTO Syntax for Variable Initialization 41

        3.1.2 Use DML in a PL/SQL Block 42

        3.1.3 Make Use of a Sequence in a PL/SQL Block 44

    LAB 3.2 Making Use of SAVEPOINT 45

        3.2.1 Make Use of COMMIT, ROLLBACK, and SAVEPOINT in a PL/SQL Block 48

Chapter 3 Try It Yourself 51


CHAPTER 4 Conditional Control: IF Statements 53

    LAB 4.1 IF Statements 54

        4.1.1 Use the IF-THEN Statement 58

        4.1.2 Use the IF-THEN-ELSE Statement 62

    LAB 4.2 ELSIF Statements 65

        4.2.1 Use the ELSIF Statement 69

    LAB 4.3 Nested IF Statements 74

        4.3.1 Use Nested IF Statements 76

Chapter 4 Try It Yourself 80


CHAPTER 5 Conditional Control: CASE Statements 81

    LAB 5.1 CASE Statements 82

        5.1.1 Use the CASE Statement 89

        5.1.2 Use the Searched CASE Statement 91

    LAB 5.2 CASE Expressions 96

        5.2.1 Use the CASE Expression 100

    LAB 5.3 NULLIF and COALESCE Functions 103

        5.3.1 The NULLIF Function 107

        5.3.2 Use the COALESCE Function 109

Chapter 5 Try It Yourself 112


CHAPTER 6 Iterative Control: Part I 113

    LAB 6.1 Simple Loops 114

        6.1.1 Use Simple Loops with EXIT Conditions 118

        6.1.2 Use Simple Loops with EXIT WHEN Conditions 120

    LAB 6.2 WHILE Loops 124

        6.2.1 Use WHILE Loops 128

    LAB 6.3 Numeric FOR Loops 132

        6.3.1 Use Numeric FOR Loops with the IN Option 137

        6.3.2 Use Numeric FOR Loops with the REVERSE Option 139

Chapter 6 Try It Yourself 142


CHAPTER 7 Iterative Control: Part II 143

    LAB 7.1 The CONTINUE Statement 144

        7.1.1 Use t...