Preface p. xv Introduction p. 1 The Logical and Physical View of Tables p. 1 Database Types p. 4 NULLs p. 6 DDL and DML Statements p. 7 Column and Table Constraint Clauses p. 7 Sample Database p. 9 A Quick Tour of SQL*Plus p. 17 What SQL*Plus? p. 17 Invoking SQL*Plus p. 19 Connecting with SQL*Plus p. 20 SQL*Plus Editing/Basic Commands p. 23 SQL*Plus Scripts p. 27 Position-Dependent Parameters p. 31 Named Parameter Substitution p. 32 Running Script from a Host User p. 34 Select Statements p. 36 Qualifying Columns p. 36 Qualifying Rows p. 38 Joins p. 39 Table Joins with Nulls p. 40 Full Outer Join p. 43 SQL Tutorial p. 43 Tutorial Solutions p. 50 Declarative Constraints p. 55 Introduction p. 55 Primary Key p. 56 Primary Key Versus Unique p. 58 Concatenated Primary Key p. 59 Declaring an Additional Not Null Constraint p. 61 Error Messages p. 62 Naming Primary Keys p. 62 PL/SQL Coding with a Primary Key p. 64 SQL*Loader--Direct Load p. 71 Unique Constraints p. 72 Concatenated UNIQUE Constraints p. 73 PL/SQL Coding with a UNIQUE Constraint p. 74 Not Null Constraints p. 75 Error Messages p. 77 Naming Not Null Constraints p. 77
PL/SQL Coding with Not Null Constraints p. 77 CHECK Constraints p. 82 Multiple Constraints p. 82 Case Sensitivity p. 82 Multicolumn Constraints p. 83 Error Messages p. 84 Boolean Types as a Check Constraint p. 85 Complex Check Constraints p. 85 Foreign Key Constraints p. 86 NULLs in the Child Table p. 89 Delete Cascade p. 91 Syntax p. 92 Concatenated Primary Key Is a Foreign Key p. 93 Lookup Tables p. 93 Delete Cascade p. 96 Converting Check Constraints to Lookup Tables p. 96 Self-referential Integrity p. 96 Managing Constraints p. 102 Introduction p. 102 Declaring Constraints Disabled p. 103 Database Table Column Defaults p. 103 Multiconstraint Columns p. 104 The Alter Table Command p. 104 Altering Status p. 106 Altering Scale and Dimension p. 106 Altering Status with Cascade p. 106 Dropping Constraints p. 107 Relationships p. 107 One-to-One Relationship p. 107 One-to-Many Relationships p. 108 Many-to-Many Relationships p. 109 Analyzing Constraints through the Data Dictionary p. 111 Introduction p. 111 User Constraint Columns p. 115 Show Constraints p. 116 Show Columns p. 117 Show Positions p. 117 User Constraints p. 119 Show Table Constraints p. 121 Show Search Condition p. 122 Show Parent p. 123
Show Parent All p. 124 Show Child p. 126 Show Child All p. 127 Show Disabled Constraints p. 129 Case Study p. 130 Summary p. 133 PL/SQL Program Units p. 135 Introduction p. 135 Procedures p. 140 Functions p. 143 Packages p. 146 The Specification p. 148 Modularity p. 151 Information Hiding p. 153 Encapsulation of Types and Operations p. 157 Data Abstraction p. 159 Users of Abstract Objects p. 163 Stepwise Refinement p. 164 A Taxonomy of Packages p. 168 Using a Package p. 170 Motivation of Exceptions with Abstract Objects p. 172 Subprogram Parameter Modes p. 173 Out Mode Considerations p. 174 Mode Preservation p. 175 Default Assignment and In Out Mode p. 176 Formal Parameter and Positional Notation p. 176 Mixed Notation p. 178 When Named Notation Is Required p. 178 Subprogram Parameter Default Values p. 179 Overloading p. 181 Overloading Versus Adding Defaults p. 183 Package Initialization p. 186 The Development Environment p. 187 Introduction p. 187 Compilation Order p. 190 Interspecification Dependencies p. 192 General Order for Compile Scripts p. 192 Concurrent Development p. 193 Automatic Recompilation p. 194 Data Dictionary Views p. 196 USER_DEPENDENCIES p. 196
USER_OBJECTS p. 198 USER_SOURCE p. 199 DBMS_OUTPUT p. 201 Package Description p. 204 Developing Procedures in SQL*Plus p. 207 Creating Stored Procedures via SQL*Plus Editor p. 207 Editing and Executing from SQL*Plus p. 208 Creating Stored Procedures with a Host Editor p. 209 Compiling Procedures, Functions, and Packages p. 210 Syntax and Constructs p. 217 Comments p. 217 Assignment p. 218 Statements and Expressions p. 219 Boolean Expression p. 219 Logical Operators p. 220 String Concatenation p. 221 Arithmetric Expressions p. 222 Variables and Constants p. 223 IF Statements p. 224 LOOP p. 225 FOR LOOP p. 227 Cursor FOR LOOPs p. 228 WHILE LOOP p. 230 EXIT Statements p. 231 Embedded SQL p. 233 Introduction p. 233 Uses of Functions p. 234 User-Defined Functions p. 237 SCALAR Versus AGGREGATE Functions p. 242 PL/SQL Exceptions with GROUP Functions p. 243 Built-in Functions p. 244 Power-String Functions p. 245 SUBSTR p. 245 INSTR p. 246 RPAD, LPAD p. 248 RTRIM, LTRIM p. 250 DECODE p. 251 REPLACE p. 252 TRANSLATE p. 253 Miscellaneous String Functions p. 254 Numeric Functions p. 255
DATE Functions p. 257 SYSDATE p. 257 ADD_MONTHS p. 258 LAST_DAY p. 259 MONTHS_BETWEEN p. 260 NEW_TIME p. 260 NEXT_DAY p. 261 ROUND p. 261 Cursors p. 262 Explicit Cursors p. 263 Fetch Loop p. 263 Cursor Parameters p. 266 Implicit Cursors p. 268 Datatypes and Composite Structures p. 271 Introduction p. 271 Groups of Datatypes p. 272 Subtypes p. 272 Oracle Predefined Datatypes p. 273 Implicit Conversion p. 276 TO_TYPE Functions p. 277 Variable%TYPE p. 279 Column%TYPE p. 280 Database Table%ROWTYPE p. 281 Cursor Table%ROWTYPE p. 282 Database Table %ROWTYPE and Cursor %ROWTYPE p. 283 PL/SQL Tables p. 285 Exceptions When Addressing PL/SQL Tables p. 286 Assignment p. 286 Programming with Tables p. 287 PL/SQL Tables Release 2.3 p. 288 Tables of Composite Structures p. 289 Table Attributes p. 289 Examples p. 290 Records p. 291 Record Initialization with Literals and Variables p. 292 Record Initialization Using Global Data and Functions p. 293 Fetching into Records p. 294 Assignment p. 295 Record Types as Parameters p. 296 RECORD Versus %ROWTYPE p. 296 Error Handling and Exeptions p. 299
Introduction p. 299 Overview of PL/SQL Error Handling Options p. 301 Exceptions p. 302 Exception Categories p. 302 Exception Propogation p. 322 Exceptions Across Language Boundaries p. 324 Raise Application Error p. 327 Using Database Pipes p. 331 Summary p. 331 Interprocess Communication p. 333 DBMS_PIPE p. 333 Package Description p. 336 Runtime Errors p. 340 Pipe Examples p. 341 Pipe Buffer p. 344 DBMS_ALERT p. 345 Asynchronous Features p. 346 Communication p. 346 Polling Versus Blocking Wait p. 347 Distributed Process Control p. 348 Alerts with Triggers p. 348 Redundent Alerts Within a Process p. 348 Package Description p. 349 Examples p. 352 DBMS_LOCK p. 354 Introduction p. 354 Example p. 355 Dynamic SQL p. 357 Introduction p. 357 Package Description p. 358 Examples p. 366 Triggers p. 377 Introduction p. 377 When Triggers Fire p. 380 Twelve Triggers--When They Fire p. 380 Firing Within a DELETE Cascade p. 382 Trigger Names p. 383 Trigger Firing Specification Code p. 385 PL/SQL Keywords and Descriptions p. 385 The OF COLUMN_NAME Clause p. 387 The WHEN Clause Option p. 388
Trigger Types Summary p. 389 Trigger Body p. 392 Correlation Values p. 392 DBMS_STANDARD Functions p. 394 Transaction Control and Application Errors p. 395 Trigger Declarations p. 397 Configuration Control of Triggers p. 397 Redundant Firing Specifications p. 397 Dynamic Environments p. 398 File Management and Version Control p. 398 Administration of Triggers p. 400 Modularity in Triggers p. 400 Trigger Dependencies p. 401 Compiling Triggers p. 401 Testing with DBMS_OUTPUT p. 402 Data Dictionary Views p. 403 USER_TRIGGERS p. 403 USER_TRIGGER_COLS p. 405 Triggers as Procedural Constraints p. 407 PL/SQL Error Messages and Codes Package p. 411 Constraint Enforcement Package p. 413 Summary p. 422 A Trigger Methodology (Part 1) p. 423 Development Steps p. 423 Statement of Rules p. 424 Construct a Constraints Violation List p. 426 Trigger Functional Description p. 427 Error/Process Analysis p. 431 Encapsulate Functionality into a Constraints Package p. 432 Compute Constraints Package Complexity p. 435 Code the Trigger p. 435 Summary of Steps p. 438 Example 1 p. 438 Example 2 p. 443 Classes of Triggers p. 448 Example 3 p. 450 Mutating Tables p. 453 What Tables Mutate p. 454 When Do Tables Mutate p. 458 A Trigger Methodology (Part 2) p. 465 PL/SQL Temp Tables p. 467
PL/SQL Table Special Cases p. 473 Concatenated Keys p. 473 Old and New Attribute Requirements p. 476 Delete Cascade p. 478 Recursive Triggers p. 484 Case Study p. 485 Constraints Violation/Enforcement List p. 486 Trigger Functional Descriptions p. 487 Consolidated Trigger Functional Descriptions p. 489 PL/SQL Code p. 491 Stored Procedure Testing p. 513 Execution from SQL*Plus p. 514 Execution from the SQL*Plus Prompt p. 514 Execution from SQL*Plus Command Files p. 515 Execution from PL/SQL Blocks p. 515 Controlling Execution through Command Line Arguments p. 518 SQL*Plus Session Variables p. 519 SQL*Plus Example p. 520 PL/SQL Example p. 520 Implicit Conversion of Session Variables p. 521 Nonsupported Session Types p. 522 Restricting the Scope of Testing p. 522 Simulating Real Data p. 524 Test Environment p. 525 Runtime Errors p. 526 Identifying the Line of Execution p. 526 Locating Invisible Errors p. 527 Tracing with DBMS_OUTPUT p. 527 Summary p. 529 Index p. 531 About the Disk p. 542 Table of Contents provided by Blackwell's Book Services and R.R. Bowker. Used with permission.