Muutke küpsiste eelistusi

Oracle PL/SQL by Example 4th edition [Pehme köide]

  • Formaat: Paperback / softback, 768 pages, kõrgus x laius x paksus: 229x177x38 mm, kaal: 1080 g
  • Ilmumisaeg: 28-Aug-2008
  • Kirjastus: Prentice Hall
  • ISBN-10: 0137144229
  • ISBN-13: 9780137144228
Teised raamatud teemal:
  • Pehme köide
  • Hind: 69,39 €*
  • * saadame teile pakkumise kasutatud raamatule, mille hind võib erineda kodulehel olevast hinnast
  • See raamat on trükist otsas, kuid me saadame teile pakkumise kasutatud raamatule.
  • Kogus:
  • Lisa ostukorvi
  • Tasuta tarne
  • Lisa soovinimekirja
  • Formaat: Paperback / softback, 768 pages, kõrgus x laius x paksus: 229x177x38 mm, kaal: 1080 g
  • Ilmumisaeg: 28-Aug-2008
  • Kirjastus: Prentice Hall
  • ISBN-10: 0137144229
  • ISBN-13: 9780137144228
Teised raamatud teemal:
Using hands-on labs, extensive examples, exercises, and projects, this tutorial teaches basic PL/SQL concepts and general programming fundamentals, covering conditional and iterative program control techniques, error and exception handling, working with cursors and triggers (including Oracle 11g's new compound triggers), and working with advanced PL/SQL capabilities such as object-relational features and bulk SQL. Appendices offer a PL/SQL formatting guide, sample database schema, and an ANSI SQL standards reference. Rosenzweig is a software development manager. Rakhimov is a software developer. Annotation ©2008 Book News, Inc., Portland, OR (booknews.com)

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

          PL/SQL

        • 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

          more

 

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.

 

Contents

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

 

CHAPTER 3 SQL in PL/SQL 39

    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 the CONTINUE Statement 146

        7.1.2 Use the CONTINUE WHEN Condition 152

    LAB 7.2 Nested Loops 154

        7.2.1 Use Nested Loops 157

Chapter 7 Try It Yourself 161

 

CHAPTER 8 Error Handling and Built-in Exceptions 163

    LAB 8.1 Handling Errors 164

        8.1.1 Understand the Importance of Error Handling 167

    LAB 8.2 Built-in Exceptions 169

        8.2.1 Use Built-in Exceptions 174

Chapter 8 Try It Yourself 178

 

CHAPTER 9 Exceptions 179

    LAB 9.1 Exception Scope 180

        9.1.1 Understand the Scope of an Exception 183

    LAB 9.2 User-Defined Exceptions 188

        9.2.1 Use User-Defined Exceptions 193

    LAB 9.3 Exception Propagation 197

        9.3.1 Understand How Exceptions Propagate 203

        9.3.2 Reraise Exceptions 206

Chapter 9 Try It Yourself 209

 

CHAPTER 10 Exceptions: Advanced Concepts 211

    LAB 10.1 RAISE_APPLICATION_ERROR 212

        10.1.1 Use RAISE_APPLICATION_ERROR 215

    LAB 10.2 EXCEPTION_INIT Pragma 217

        10.2.1 USE the EXCEPTION_INIT Pragma 219

    LAB 10.3 SQLCODE and SQLERRM 222

        10.3.1 Use SQLCODE and SQLERRM 225

Chapter 10 Try It Yourself 227

 

CHAPTER 11 Introduction to Cursors 229

    LAB 11.1 Cursor Manipulation 230

        11.1.1 Make Use of Record Types 234

        11.1.2 Process an Explicit Cursor 235

        11.1.3 Make Use of Cursor Attributes 240

        11.1.4 Put It All Together 242

    LAB 11.2 Using Cursor FOR Loops and Nested Cursors 246

        11.2.1 Use a Cursor FOR Loop 247

        11.2.2 Process Nested Cursors 247

Chapter 11 Try It Yourself 252

 

CHAPTER 12 Advanced Cursors 253

    LAB 12.1 Using Parameters with Cursors and Complex Nested Cursors 254

        12.1.1 Use Parameters in a Cursor 255

        12.1.2 Use Complex Nested Cursors 255

    LAB 12.2 FOR UPDATE and WHERE CURRENT Cursors 258

        12.2.1 For UPDATE and WHERE CURRENT Cursors 258

 

CHAPTER 13 Triggers 263

    LAB 13.1 What Triggers Are 264

        13.1.1 Understand What a Trigger Is 272

        13.1.2 Use BEFORE and AFTER Triggers 274

    LAB 13.2 Types of Triggers 277

        13.2.1 Use Row and Statement Triggers 283

        13.2.2 Use INSTEAD OF Triggers 285

Chaper 13 Try It Yourself 290

 

CHAPTER 14 Compound Triggers 291

    LAB 14.1 Mutating Table Issues 292

        14.1.1 Understand Mutating Tables 296

    LAB 14.2 Compound Triggers 300

        14.2.1 Understand Compound Triggers 306

Chapter 14 Try It Yourself 313

 

CHAPTER 15 Collections 315

    LAB 15.1 PL/SQL Tables 316

        15.1.1 Use Associative Arrays 326

        15.1.2 Use Nested Tables 330

    LAB 15.2 Varrays 334

        15.2.1 Use Varrays 338

    LAB 15.3 Multilevel Collections 342

        15.3.1 Use Multilevel Collections 344

Chapter 15 Try It Yourself 348

 

CHAPTER 16 Records 349

    LAB 16.1 Record Types 350

        16.1.1 Use Table-Based and Cursor-Based Records 358

        16.1.2 Use User-Defined Records 362

    LAB 16.2 Nested Records 367

        16.2.1 Use Nested Records 369

    LAB 16.3 Collections of Records 373

        16.3.1 Use Collections of Records 374

Chapter 16 Try It Yourself 378

 

CHAPTER 17 Native Dynamic SQL 379

    LAB 17.1 EXECUTE IMMEDIATE Statements 380

        17.1.1 Use the EXECUTE IMMEDIATE Statement 387

    LAB 17.2 OPEN-FOR, FETCH, and CLOSE Statements 392

        17.2.1 Use OPEN-FOR, FETCH, and CLOSE Statements 395

Chapter 17 Try It Yourself 401

 

CHAPTER 18 Bulk SQL 403

    LAB 18.1 The FORALL Statement 404

        18.1.1 Use the FORALL Statement 413

    LAB 18.2 The BULK COLLECT Clause 422

        18.2.1 Use the BULK COLLECT Statement 428

Chapter 18 Try It Yourself 437

 

CHAPTER 19 Procedures 439

    LAB 19.1 Creating Procedures 441

        19.1.1 Create Procedures 441

        19.1.2 Query the Data Dictionary for Information on Procedures 443

    LAB 19.2 Passing Parameters into and out of Procedures 444

        19.2.1 Use IN and OUT Parameters with Procedures 445

Chapter 19 Try It Yourself 447

    Part 1 447

    Part 2 447

 

CHAPTER 20 Functions 449

    LAB 20.1 Creating and Using Functions 450

        20.1.1 Create Stored Functions 451

        20.1.2 Make Use of Functions 452

        20.1.3 Invoke Functions in SQL Statements 453

        20.1.4 Write Complex Functions 454

Chapter 20 Try It Yourself 455

 

CHAPTER 21 Packages 457

    LAB 21.1 The Benefits of Using Packages 458

        21.1.1 Create Package Specifications 460

        21.1.2 Create Package Bodies 462

        21.1.3 Call Stored Packages 464

        21.1.4 Create Private Objects 465

        21.1.5 Create Package Variables and Cursors 469

    LAB 21.2 Cursor Variables 471

        21.2.1 Make Use of Cursor Variables 475

    LAB 21.3 Extending the Package 480

        21.3.1 Extend the Package 480

Chapter 21 Try It Yourself 493

 

CHAPTER 22 Stored Code 495

    LAB 22.1 Gathering Information About Stored Code 496

        22.1.1 Get Stored Code Information from the Data Dictionary 496

        22.1.2 Enforce the Purity Level with the RESTRICT_REFERENCES Pragma 500

        22.1.3 Overload Modules 506

Chapter 22 Try It Yourself 512

 

CHAPTER 23 Object Types in Oracle 513

    LAB 23.1 Object Types 514

        23.1.1 Use Object Types 522

        23.1.2 Use Object Types with Collections 526

    LAB 23.2 Object Type Methods 531

        23.2.1 Use Object Type Methods 544

Chapter 23 Try It Yourself 554

 

CHAPTER 24 Oracle Supplied Packages 555

    LAB 24.1 Making Use of Oracle Supplied Packages to Profile PL/SQL, Access Files, and Schedule Jobs 556

        24.1.1 Access Files with UTL_FILE 563

        24.1.2 Schedule Jobs with DBMS_JOB 563

        24.1.3 Submit Jobs 564

    LAB 24.2 Making Use of Oracle-Supplied Packages to Generate an Explain Plan and Create HTML Pages 568

        24.2.1 Generate an Explain Plan with DBMS_XPLAN 572

    LAB 24.3 Creating Web Pages with the Oracle Web Toolkit 578

        24.3.1 Create an HTML Page with the Oracle Web Toolkit 594

 

APPENDIX A PL/SQL Formatting Guide 597

APPENDIX B Student Database Schema 601

APPENDIX C ANSI SQL Standards 607

APPENDIX D Answers to the Try It Yourself Sections 613

INDEX 705

Muu info

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 fundamentals, from PL/SQL syntax and program control through packages and Oracle 11gs significantly improved triggers.

 

One step at a time, youll 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 youve learned, strengthening your understanding through real-world practice.

 

This books approach fully refl ects 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 SQLs role in PL/SQL 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 11gs powerful new compound triggers Using stored procedures, functions, and packages to write modular code that other programs can execute Working with collections, 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 more

Acknowledgments                                                                           

About the Authors

Introduction  

                                                                                  

Chapter 1 PL/SQL Concepts                                                    



    Lab 1.1 PL/SQL in Client-Server Architecture                                            

        1.1.1 Use PL/SQL Anonymous Blocks                                                           

        1.1.2 Understand How PL/SQL Gets Executed                                              

    Lab 1.2 PL/SQL in SQL*Plus                                                                            

        1.2.1  Use Substitution Variables                                                                       

        1.2.2 Use the DBMS_OUTPUT.PUT_LINE Statement                                 

    Chapter 1 Try It Yourself

                                                                                

Chapter 2 General Programming Language Fundamentals           

    Lab 2.1 PL/SQL Programming Fundamentals                                                 

        2.1.1 Make Use of PL/SQL Language Components                                         

        2.1.2 Make Use of PL/SQL Variables

        2.1.3 Handle PL/SQL Reserved Words

        2.1.4 Make Use of Identifiers in PL/SQL

        2.1.5 Make Use of Anchored Data Types

        2.1.6 Declare and Initialize Variables

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

    Chapter 2 Try It Yourself

                                                                                

Chapter 3 SQL in PL/SQL                                                        

    Lab 3.1 PL/SQL Programming Fundamentals                                                 

        3.1.1 Make Use of PL/SQL Language Components                                         

        3.1.2 Make Use of PL/SQL Variables                                                               

        3.1.3 Handle PL/SQL Reserved Words                                                             

        3.1.4 Make Use of Identifiers in PL/SQL                                                         

        3.1.5 Make Use of Anchored Data Types                                                          

        3.1.6 Declare and Initialize Variables                                                                

        3.1.7 Understand the Scope of a Block,                     Nested Blocks, and Labels   

    Chapter 3 Try It Yourself     

                                                                          

Chapter 4 Conditional Control: IF Statements                            

    Lab 4.1 IF Statements                                                                                         

        4.1.1 Use the IF-THEN Statement                                                                    



        4.1.2 Use the IF-THEN-ELSE Statement                                                          

    Lab 4.2 ELSIF Statements                                                                                  

        4.2.1  Use the ELSIF Statement

    Lab 4.3 Nested IF Statements

        4.3.1 - Use Nested IF Statements

    Chapter 4 Try It Yourself  

                                                                             



Chapter 5 Conditional Control: CASE Statements                      

    Lab 5.1 CASE Statements                                                                                   

        5.1.1 Use the CASE Statement                                                                            

        5.1.2 Use the SEARCHED CASE Statement                                                     

    Lab 5.2 CASE Expressions                                                                                 

        5.2.1 Use the CASE Expression                                                                          

    Lab 5.3 NULLIF and COALESCE Functions                                                   

        5.3.1 Use The NULLIF Function

        5.3.2 Use The COALESCE Function

    Chapter 5 Try It Yourself      

                                                                         

Chapter 6 Iterative Control: Part 1                                              

    Lab 6.1 Simple Loops                                                                                         

        6.1.1 Use Simple Loops with EXIT Conditions                                                

        6.1.2 Use Simple Loops with EXIT WHEN Conditions                                  

    Lab 6.2 WHILE Loops                                                                                        

        6.2.1 Use WHILE Loops                                                                                      

    Lab 6.3 Numeric FOR Loops                                                                             

        6.3.1 Use Numeric FOR Loops with the IN Option                                         

        6.3.2 Use Numeric For Loops With the REVERSE Option                            

    Chapter 6 Try It Yourself       

                                                                        

Chapter 7 Iterative Control: Part 2                                              

    Lab 7.1 CONTINUE Statement                                                                          

        7.1.1  Use the CONTINUE Statement

        7.1.2 - Use the CONTINUE WHEN Condition                                                 

    Lab 7.2 Nested Loops                                                                                         

        7.2.1 Use Nested Loops                                                                                       

    Chapter 7 Try It Yourself   

                                                                            



Chapter 8 Error Handling and Built-In Exceptions                      

    Lab 8.1 Handling Errors                                                                                     

        8.1.1 Understanding the Importance of Error Handling                                   

    Lab 8.2 Built-In Exceptions                                                                               

        8.2.1 Use Built-In Exceptions                                                                             

    Chapter 8 Try It Yourself     

                                                                          

Chapter 9 Exceptions                                                                

    Lab 9.1 Exception Scope                                                                                    

        9.1.1 Understand the Scope of an Exception                                                     

    Lab 9.2 User-Defined Exceptions                                                                     

        9.2.1 Use User-Defined Exceptions

    Lab 9.3 Exception Propagation

        9.3.1 Understand How Exceptions Propagate

        9.3.2 Re-raise Exceptions                                                                                        

    Chapter 9 Try It Yourself   

                                                                            



Chapter 10 Exceptions: Advanced Concepts                              

    Lab 10.1 RAISE_APPLICATION_ERROR                                                     



        10.1.1 Use RAISE_APPLICATION_ERROR                                                   

    Lab 10.2 EXCEPTION_INIT PRAGMA                                                          

        10.2.1 Use EXCEPTION_INIT PRAGMA                                                        

    Lab 10.3 SQLCODE and SQLERRM                                                               

        10.3.1 Use SQLCODE AND SQLERRM                                                          

    Chapter 10 Try It Yourself 

                                                                            



Chapter 11 Introduction to Cursors                                           



    Lab 11.1 Cursor Manipulation                                                                           

        11.1.1 Make Use of Record Types

        11.1.2 Process An Explicit Cursor

        11.1.3 Make Use of Cursor Attributes

        11.1.4 Put it All Together                                                                                    

    Lab 11.2 Using Cursor FOR LOOPS and Nesting Cursors                            

        11.2.1 Using a Cursor FOR LOOP

        11.2.2 Process Nested Cursors                                                                           

    Chapter 11 Try It Yourself     

                                                                        

Chapter 12 Advanced Cursors                                                  



    Lab 12.1 Using Parameters with Cursors and Nested Cursors                      

        12.1.1 Cursors with Parameters                                                                          

        12.1.2 Complex Nested Cursors                                                                         

    Lab 12.2 FOR UPDATE and WHERE CURRENT Cursors                           



        12.2.1 Use FOR UPDATE and WHERE CURRENT Cursors                         

    Chapter 12 Try It Yourself     

                                                                        

Chapter 13 Triggers                                                                  

    Lab 13.1 What Triggers Are                                                                               

        13.1.1 Understand What a Trigger Is                                                                  

        13.1.2 Use Before and After Triggers                                                               

    Lab 13.2 Types of Triggers                                                                                

        13.2.1 Use ROW And STATEMENT Triggers

        13.2.2 Use INSTEAD OF Triggers

    Chapter 13 Try It Yourself   

                                                                          

Chapter 14 Compound Triggers                                                



    Lab 14.1 Mutating Table Issues                                                                         

        14.1.1 Understand Mutating Tables

    Lab 14.2 Compound Triggers

        14.2.1 Understand COMPOUND Triggers                                                            

    Chapter 14 Try It Yourself  

                                                                         

Chapter 15 Collections                                                              

    Lab 15.1 PL/SQL Tables                                                                                    

        15.1.1 Use Associative Arrays                                                                            

        15.1.2 Use Nested Tables                                                                                    

    Lab 15.2 Varrays                                                                                                 

        15.2.1 Use Varrays

    Lab 15.3 Multilevel Collections

        15.3.1 Use Multilevel Collections                                                                      

    Chapter 15 Try It Yourself 

                                                                                 

Chapter 16 Records                                                                  

    Lab 16.1 Record Types                                                                                       

        16.1.1 Use Table-Based and Cursor-Based Records

        16.1.2 Use User-Defined Records

    Lab 16.2 Nested Records

        16.2.1 Use Nested Records

    Lab 16.3 Collections of Records

        16.3.1 Use Collections of Records

    Chapter 16 Try It Yourself    

                                                                         

Chapter 17 Native Dynamic SQL                                               



    Lab 17.1 EXECUTE IMMEDIATE Statements                                               

        17.1.1 Use the EXECUTE IMMEDIATE Statement                                         

        17.1.2 Use BEFORE and AFTER Triggers                                                        

    Lab 17.2 OPEN-FOR, FETCH, and CLOSE Statements                                 

        17.2.1 Use OPEN-FOR, FETCH, and CLOSE Statements

        17.2.2 Use INSTEAD OF Triggers                                                                     



    Chapter 17 Try It Yourself   

                                                                          

Chapter 18 Bulk SQL                                                                

    Lab 18.1 FORALL Statement                                                                             

        18.1.1 Use FORALL Statement

    Lab 18.2 BULK COLLECT Clause

        18.2.1 Use BULK COLLECT Statement

    Chapter 18 Try It Yourself 

                                                                            



Chapter 19 Procedures                                                              

    Lab 19.1 Creating Procedures                                                                           

        19.1.1 Create Procedures

        19.1.2 Query the Data Dictionary for Information on Procedures

    Lab 19.2 Passing Parameters In and Out of Procedures                                 

        19.2.1 Use IN and OUT Parameters with Procedures

    Chapter 19 Try It Yourself

                                                                             



Chapter 20 Functions                                                                

    Lab 20.1 Creating and Using Functions                                                           

        20.1.1 Create Stored Functions

        20.1.2 Make Use of Functions

        20.1.3  Invoke Functions in SQL Statements

        20.1.4 Write Complex Functions

    Chapter 20 Try It Yourself   

                                                                          

Chapter 21 Packages                                                                 

    Lab 21.1 The Benefits of Utilizing Packages                                                  

        21.1.1 Create Package Specifications

        21.1.2 Create Package Bodies

        21.1.3 Call Stored Packages

        21.1.4 Create Private Objects

        21.1.5 Create Package Variables and Cursors

    Lab 21.2 Cursor Variables

        21.2.1 Make Use of Cursor Variables

    Lab 21.3 Extending the Package

        21.3.1 Understand how to Extend Packages

    Chapter 21 Try It Yourself

 

Chapter 22 Stored Code                                                           

    Lab 22.1 Gathering Stored Code Information

        22.1.1 Get Stored Code Information from the Data Dictionary

        22.1.2 Enforce Purity Level with RESTRICT_REFERENCES Pragma

        22.1.3 Overload Modules

    Chapter 22 Try It Yourself

 

Chapter 23 Object Types in Oracle                                            



    Lab 23.1 Object Types

        23.1.1 Use Object Types

        23.1.2 Use Object Types with Collections

    Lab 23.2 Object Type Methods

        23.2.1 Use Object Type Methods

    Chapter 23 Try It Yourself

 

Chapter 24 Oracle Supplied Packages                                        

    Lab 24.1 Making Use of Oracle Supplied Packages to Profile PL/SQL, Access Files and Schedule Jobs

        24.1.1 Access Files with UTL_FILE

        24.1.2 Job Scheduling with DBMS_JOB

        24.1.3 Submitting Jobs

    Lab 24.2 Making Use of Oracle Supplied Packages to Generate an Explain Plan and create HTML pages

        24.2.1 Generate an Explain Plan

    Lab 24.3 Creating Web pages with the Oracle Web Toolkit

        24.3.1 Create an HTML Page with the Oracle Web Toolkit

 

Appendix A  PL/SQL Formatting Guide                                      

Appendix B  Student Database Schema                                       

Appendix C  ANSI SQL Standards                                             

Appendix D  Answers to Try it Yourself Sections  
Acknowledgments xiv
About the Authors xv
Introduction xvii
PL/SQL Concepts
1(20)
PL/SQL in Client/Server Architecture
2(10)
Use PL/SQL Anonymous Blocks
8(2)
Understand How PL/SQL Gets Executed
10(2)
PL/SQL in SQL*Plus
12(9)
Use Substitution Variables
16(1)
Use the DBMS_OUTPUT.PUT_LINE Statement
17(2)
Try It Yourself
19(2)
General Programming Language Fundamentals
21(18)
PL/SQL Programming Fundamentals
22(17)
Make Use of PL/SQL Language Components
23(1)
Make Use of PL/SQL Variables
24(2)
Handle PL/SQL Reserved Words
26(1)
Make Use of Identifiers in PL/SQL
27(1)
Make Use Of Anchored Datatypes
28(3)
Declare and Initialize Variables
31(3)
Understand the Scope of a Block, Nested Blocks, and Labels
34(3)
Try It Yourself
37(2)
SQL in PL/SQL
39(14)
Making Use of DML PL/SQL
40(5)
Use the Select INTO Syntax for Variable Initialization
41(1)
Use DML in a PL/SQL Block
42(2)
Make Use of a Sequence in a PL/SQL Block
44(1)
Making Use of Savepoint
45(8)
Make Use of Commit, Rollback, and Savepoint in a PL/SQL Block
48(3)
Try It Yourself
51(2)
Conditional Control: If Statements
53(28)
If Statements
54(11)
Use the If-Then Statement
58(1)
Use the IF-THEN-ELSE Statement
58(7)
ELSIF Statements
65(9)
Use the ELSIF Statement
69(5)
Nested If Statements
74(7)
Use Nested If Statement
76(4)
Try It Yourself
80(1)
Conditional Control: CASE Statements
81(32)
CASE Statements
82(14)
Use the CASE Statements
89(2)
Use the Searched CASE Statement
91(5)
CASE Experessions
96(7)
Use the CASE Expression
100(3)
Nullif and coalesce Functions
103(10)
The Nullif function
107(2)
Use the Coalesce Function
109(3)
Try It Yourself
112(1)
Iterative Control: Part I
113(30)
Simple Loops
114(10)
Use Simple Loops with EXIT Conditions
118(2)
Use Simple Loops with EXIT When Conditions
120(4)
While Loops
124(8)
Use While Loops
128(4)
Numeric for Loops
132(11)
Use Numeric For Loops with the In Option
137(2)
Use Numeric For Loops with the Reverse Option
139(3)
Try It Yourself
142(1)
Iterative control: Part II
143(20)
The continue Statement
144(10)
Use the Continue Statement
146(6)
Use the Continue When condition
152(2)
Nested Loops
154(9)
use Nested Loops
157(4)
Try It Yourself
161(2)
Error Handling and Built-in Exceptions
163(16)
Handling Errors
164(5)
Understand the Importance of Error Handling
167(2)
Built-in Exceptions
169(10)
Use Built -in Exceptions
174(4)
Try It Yourself
178(1)
Exceptions
179(32)
Exception Scope
180(8)
Understand the Scope of an Exception
183(5)
User-Defined Exceptions
188(9)
Use User-Defined Exceptions
193(4)
Exception Propagation
197(14)
Understand How Exceptions Propagate
203(3)
Reraise Exceptions
206(3)
Try It Yourself
209(2)
Exceptions: Advanced Concepts
211(18)
Raise_Application_Error
212(5)
Use Raise_Application_Error
215(2)
Exception_Init Pragma
217(5)
Use the Exception_Init Pragma
219(3)
Sqlcode and Sqlerrm
222(7)
Use Squlcode and Sqjlerrm
225(2)
Try It Yourself
227(2)
Introduction to Cursors
229(24)
Cursor Manipulation
230(16)
Make Use of Record Types
234(1)
Process an Explicit Cursor
235(5)
Make use of Cursor Attributes
240(2)
Put It All Together
242(4)
Using Curosr For Loops and Nested Cursors
246(7)
Use a Cursor For Loop
247(1)
Process Nested Cursors
247(5)
Try It Yourself
252(1)
Advanced Curosrs
253(10)
Using Parameters with Cursors and Complex Nested Cursors
254(4)
Use Parameters in a Cursor
255(1)
Use Complex Nested Cursors
255(3)
For Update and Where Current cursors
258(5)
For Update and Where Current Cursors
258(5)
Triggers
263(28)
What Triggers Are
264(13)
Understand What a Trigger Is
272(2)
Use Before and Agter Triggers
274(3)
Types of Triggers
277(14)
Use Row and Statement Triggers
283(2)
Use INSTEAD of Triggers
285(5)
Try It Yourself
290(1)
Compound Triggers
291(24)
Mutating Table Issues
292(8)
Understand Mutating Tables
296(4)
Compound Triggers
300(15)
Understand Compound Triggers
306(7)
Try It Yourself
313(2)
Collections
315(34)
PL/SQL Tables
316(18)
Use Associative Arrays
326(4)
Use Nested Tables
330(4)
Varrays
334(8)
Use Varrays
338(4)
Multilevel Collections
342(7)
Use Multilevel Collections
344(4)
Try It Yourself
348(1)
Records
349(30)
Record Types
350(17)
Use Table-Based and Curosr -Based Records
358(4)
Use User -Defined Records
362(5)
Neted Records
367(6)
User Nested Records
369(4)
Collections of Records
373(6)
Use Collections of Records
374(4)
Try It Yourself
378(1)
Native Dynamic SQL
379(24)
Execute Immediate Statements
380(12)
use the Execute Immediate Statement
387(5)
Open-For, Fetch, and Close Statements
392(11)
Use OPEN-FOR, FETCH, and CLOSE Statements
395(6)
Try It Yourself
401(2)
Bulk SQL
403(36)
The FORALL Statement
404(18)
Use tge FIRALL Statement
413(9)
The BULK COLLECT Clause
422(17)
Use the BULK COLLECT Statement
428(9)
Try Itr Yourself
437(2)
Procedures
439(10)
Creating Procedures
441(3)
Create Procedures
441(2)
Query the Data Dictionary for Information on Procedures
443(1)
Passing Parameters into and Out of Procedures
444(5)
Use IN and OUT Parameters with Procedures
445(2)
Try It Yourself
447(1)
Part 1
447(1)
Part 2
447(2)
Functions
449(8)
Creating and Using Functions
450(7)
Create Stored Functions
451(1)
Make Use of Functions
452(1)
Invoke Functions in SQL Statements
453(1)
Write Complex Functions
454(1)
Try it Yourself
455(2)
Packages
457(38)
The Benefits of Using Packages
458(13)
Create Package Sjpecifications
460(2)
Create Package Bodies
462(2)
Call Stored Packages
464(1)
Create Private Objects
465(4)
Create Package Variables and Cursors
469(2)
Cursor Variables
471(9)
Make Use of Cursor Variables
475(5)
Extending the Package
480(15)
Extend the Package
480(13)
Try It Yourself
493(2)
Stored Code
495(18)
Gathering Information About Storecd Code
496(17)
Get Stored Code Information from the Data Dictionary
496(4)
Enforce the Purity Level with the RESTRICT_REFERENCES Pragma
500(6)
Overload Modules
506(6)
Try It Yourself
512(1)
Object Types in Orcale
513(42)
Object Types
514(17)
use Object Types
522(4)
Use Object Types with Collections
526(5)
Object Types Methods
531(24)
Use Object Type methods
544(10)
Try It Yourself
554(1)
Oracle Supplied Packages
555(42)
Making Use of Oracle Supplied Packages to Profile PL/SQL, Access Files, and Schedule Jobs
556(12)
Access Files with UTL_FILE
563(1)
Schedule Jobs with DBMS_JOB
563(1)
Submit Jobs
564(4)
Making Use of Oracle-Supplied Packages to Generate an Explain Plan and Create HTML Pages
568(10)
Generate an Explain Plan with DBMS_XPLAN
572(6)
Creating Web Pages with the oracle Web Toolkit
578(19)
Create an HTML Page with the Oracle Web Toolkit
594(3)
Appendix A PL/SQL Formating Guide 597(4)
Appendix B Student Database Schema 601(6)
Appendix C ANSI SQL Standards 607(6)
Appendix D Answers to the Try It Yourself Sections 613(92)
Index 705
Benjamin Rosenzweig

is a software development manager at Misys Treasury & Capital Markets, where he has worked since 2002. Prior to that he was a principal consultant for more than three years at Oracle Corporation in the Custom Development Department. His computer experience ranges from creating an electronic TibetanEnglish dictionary in Kathmandu, Nepal, to supporting presentation centers at Goldman Sachs and managing a trading system at TIAA-CREF. Rosenzweig has been an instructor at the Columbia University Computer Technology and Application program in New York City since 1998. In 2002 he was awarded the Outstanding Teaching Award from the chair and director of the CTA program. He holds a B.A. from Reed College and a certificate in database development and design from Columbia University. His previous books with Prentice Hall are Oracle Forms Developer: The Complete Video Course (ISBN: 0-13-032124-9) and Oracle Web Application Programming for PL/SQL Developers (ISBN: 0-13-047731-1).

 

Elena Silvestrova Rakhimov has more than 15 years of experience in database development in a wide spectrum of enterprise and business environments, ranging from nonprofit organizations to Wall Street. She currently works at Alea Software, where she serves as Senior Developer and Team Lead. Her determination to stay hands-on notwithstanding, Rakhimov has managed to excel in the academic arena, having taught relational database programming at Columbia Universitys highly esteemed Computer Technology and Applications program. She was educated in database analysis and design at Columbia University and in applied mathematics at Baku State University in Azerbaijan. She currently resides in Vancouver, Canada.