Foreword |
|
xvii | |
Preface |
|
xxi | |
Acknowledgments |
|
xxiii | |
Introduction |
|
xxv | |
Part I The Importance of SQL, PL/SQL, and a Good Data Model |
|
|
|
3 | (8) |
|
Introduction to SQL and PUSQL |
|
|
4 | (1) |
|
|
4 | (5) |
|
|
9 | (1) |
|
|
10 | (1) |
|
2 Expert Data Modeling and Implementing Business Logic |
|
|
11 | (20) |
|
Implementing Business Logic |
|
|
12 | (2) |
|
Business Logic in Database Objects |
|
|
12 | (1) |
|
Business Logic in the Code |
|
|
13 | (1) |
|
Designing a Database and Data Models |
|
|
14 | (13) |
|
|
14 | (6) |
|
Introduction to Oracle SQL Developer Data Modeler |
|
|
20 | (7) |
|
|
27 | (4) |
Part II Underutilized Advanced SQL Functionality |
|
|
3 Handling Advanced and Complex Data Sets |
|
|
31 | (62) |
|
Some Tools for Designing the Database |
|
|
32 | (35) |
|
|
32 | (8) |
|
|
40 | (1) |
|
Views and Materialized Views |
|
|
41 | (4) |
|
Introduction to Data Types |
|
|
45 | (13) |
|
|
58 | (2) |
|
|
60 | (1) |
|
|
61 | (3) |
|
|
64 | (2) |
|
|
66 | (1) |
|
Some Tools for Implementing SQL and PL/SQL Requirements |
|
|
67 | (23) |
|
|
68 | (3) |
|
|
71 | (3) |
|
|
74 | (13) |
|
|
87 | (1) |
|
Table Functions and Pipelined Table Functions |
|
|
88 | (2) |
|
|
90 | (3) |
|
|
93 | (28) |
|
Basic Search and Escape Possibilities |
|
|
94 | (2) |
|
|
96 | (7) |
|
|
103 | (5) |
|
Greediness and Negating the Expression |
|
|
103 | (2) |
|
|
105 | (2) |
|
|
107 | (1) |
|
|
108 | (6) |
|
Breaking Up a Delimited String |
|
|
108 | (3) |
|
Sorting by the Numeric Part of a String |
|
|
111 | (3) |
|
Pattern Matching: MATCH_RECOGNIZE |
|
|
114 | (5) |
|
|
119 | (2) |
|
5 Edition-Based Redefinition |
|
|
121 | (44) |
|
|
122 | (1) |
|
|
122 | (1) |
|
|
123 | (3) |
|
Preparation: Enable Editions |
|
|
126 | (4) |
|
|
126 | (3) |
|
|
129 | (1) |
|
|
130 | (21) |
|
|
130 | (4) |
|
Changing Table Structures |
|
|
134 | (5) |
|
Keeping the Data in Sync Between Editions |
|
|
139 | (10) |
|
|
149 | (2) |
|
|
151 | (3) |
|
|
152 | (1) |
|
Changing the Default Edition |
|
|
153 | (1) |
|
|
154 | (4) |
|
|
158 | (2) |
|
|
160 | (5) |
Part III Essential Everyday Advanced PL/SQL |
|
|
6 Running PL/SQL from SQL |
|
|
165 | (54) |
|
|
166 | (12) |
|
STANDARD and DBMS_STANDARD |
|
|
167 | (4) |
|
Simplifying Nested SQL Functions with PUSQL |
|
|
171 | (7) |
|
PUSQL Function Considerations |
|
|
178 | (39) |
|
Parameters, Purity Levels, and Deterministic |
|
|
178 | (6) |
|
Context Switching Overhead |
|
|
184 | (19) |
|
Loss of Point-in-Time View |
|
|
203 | (3) |
|
|
206 | (10) |
|
Correct Implementation for the DISP_NAME Functionality |
|
|
216 | (1) |
|
|
217 | (2) |
|
7 Instrumenting and Profiling PL/SQL |
|
|
219 | (88) |
|
SQL and RDBMS Instrumentation |
|
|
222 | (1) |
|
|
222 | (1) |
|
Instrumentation Is Built In by the Developer but Sometimes Seen Only by the DBA |
|
|
223 | (1) |
|
Instrumentation for Debugging |
|
|
223 | (1) |
|
The Difference Between Instrumentation, Profiling, and Debugging |
|
|
224 | (2) |
|
|
224 | (1) |
|
|
225 | (1) |
|
|
226 | (1) |
|
|
226 | (36) |
|
|
226 | (14) |
|
|
240 | (9) |
|
|
249 | (12) |
|
Overview of Instrumentation Options |
|
|
261 | (1) |
|
|
261 | (1) |
|
|
262 | (42) |
|
Drawbacks of Profiling Production Code with DBMS_OUPUT |
|
|
262 | (1) |
|
Using the PLSQL_LOG Table |
|
|
263 | (4) |
|
A Real-World Example of the Power of Instrumentation |
|
|
267 | (1) |
|
Profiling and Debugging Packages |
|
|
268 | (35) |
|
Overview of the Profiling Options |
|
|
303 | (1) |
|
|
304 | (3) |
|
|
307 | (16) |
|
|
308 | (4) |
|
Using the DBMS_SQL Package |
|
|
312 | (9) |
|
Returning a Result Set to the Client |
|
|
313 | (2) |
|
Calling an Implicit Result Set from PUSQL |
|
|
315 | (1) |
|
The DBMS_SQL.TO_REFCURSOR Function |
|
|
316 | (2) |
|
The DBMS_SQL.TO_CURSOR_NUMBER Function |
|
|
318 | (3) |
|
|
321 | (2) |
|
9 PL/SQL for Automation and Administration |
|
|
323 | (76) |
|
|
325 | (1) |
|
Simple Task-Specific PUSQL Scripts |
|
|
325 | (9) |
|
Investigating LONGS with PL/SQL |
|
|
326 | (1) |
|
Complex SQL or Simple PUSQL: Identifying SQL with Identical Execution Plans |
|
|
327 | (2) |
|
A Lightweight Tool for Gathering and Preserving Session Stats |
|
|
329 | (3) |
|
Handling Database Statistics Rapidly Becoming Stale |
|
|
332 | (1) |
|
A Flexible Emergency Backup Script via PUSQL |
|
|
332 | (2) |
|
Controlling Administrative and Batch Tasks with PUSQL |
|
|
334 | (32) |
|
The Core Master-Detail Control Tables |
|
|
335 | (10) |
|
|
345 | (21) |
|
|
366 | (1) |
|
PUSQL Packages for Aiding Database Developers and Administration |
|
|
366 | (30) |
|
Built-in PUSQL Packages Covered Elsewhere in This Book |
|
|
367 | (1) |
|
|
367 | (8) |
|
|
375 | (10) |
|
|
385 | (1) |
|
|
386 | (10) |
|
|
396 | (3) |
Part IV Advanced Analytics |
|
|
10 In-Database Data Mining Using Oracle Data Mining |
|
|
399 | (40) |
|
Overview of Oracle Advanced Analytics Option |
|
|
400 | (1) |
|
Oracle Data Miner GUI Tool |
|
|
401 | (4) |
|
Setting Up Oracle Data Miner and the Demo Data Sets |
|
|
403 | (1) |
|
Creating an Oracle Data Miner Workflow |
|
|
404 | (1) |
|
Oracle Data Mining Using SQL and PUSQL |
|
|
405 | (4) |
|
Oracle Data Mining PUSQL API |
|
|
407 | (1) |
|
Oracle Data Mining SQL Functions |
|
|
407 | (2) |
|
Classification Using Oracle Data Mining |
|
|
409 | (28) |
|
|
410 | (11) |
|
Building the Classification Model |
|
|
421 | (7) |
|
Evaluating the Classification Model |
|
|
428 | (5) |
|
Applying the Classification Model to New Data |
|
|
433 | (4) |
|
Oracle Data Mining: Other Techniques |
|
|
437 | (1) |
|
|
438 | (1) |
|
|
439 | (34) |
|
The ORE Transparency Layer |
|
|
440 | (1) |
|
Installing Oracle R Enterprise |
|
|
441 | (7) |
|
Installation Prerequisites |
|
|
442 | (1) |
|
|
442 | (3) |
|
|
445 | (3) |
|
Using Oracle Pre-Built Appliances |
|
|
448 | (1) |
|
Getting Started and Connecting to the Oracle Database |
|
|
448 | (4) |
|
Exploring Your Data Using ORE |
|
|
452 | (6) |
|
Building Data Mining Models Using ORE |
|
|
458 | (6) |
|
Association Rule Analysis |
|
|
458 | (3) |
|
Building a Decision Tree Model and Scoring New Data |
|
|
461 | (3) |
|
Building a Neural Network Model and Scoring New Data |
|
|
464 | (1) |
|
|
464 | (8) |
|
Using rqEval to Call Functions and Return a Data Set |
|
|
465 | (2) |
|
Using rqTableEval to Apply a Data Mining Model to Your Data |
|
|
467 | (3) |
|
Creating and Using ORE Graphics in Your Dashboards |
|
|
470 | (2) |
|
|
472 | (1) |
|
12 Predictive Queries in Oracle 12c |
|
|
473 | (22) |
|
What Are Predictive Queries and Why Do You Need Them? |
|
|
474 | (4) |
|
Oracle Analytic Functions |
|
|
475 | (1) |
|
The Magic of the Partitioning Clause |
|
|
476 | (2) |
|
Creating Predictive Queries |
|
|
478 | (4) |
|
Creating Predictive Queries in SQL Developer |
|
|
478 | (1) |
|
Creating Predictive Queries in Oracle Data Miner |
|
|
478 | (4) |
|
Predictive Queries Using SQL |
|
|
482 | (10) |
|
Classification Using Predictive Queries |
|
|
483 | (2) |
|
Regression Using Predictive Queries |
|
|
485 | (2) |
|
Anomaly Detection Using Predictive Queries |
|
|
487 | (3) |
|
Clustering Using Predictive Queries |
|
|
490 | (2) |
|
Working with Predictive Queries |
|
|
492 | (1) |
|
|
492 | (3) |
Part V Database Security |
|
|
|
495 | (30) |
|
|
496 | (2) |
|
PUSQL-Only Solution for Redaction |
|
|
498 | (8) |
|
|
498 | (5) |
|
|
503 | (3) |
|
|
506 | (1) |
|
Redaction and Masking Pack |
|
|
506 | (17) |
|
|
509 | (1) |
|
|
510 | (10) |
|
|
520 | (1) |
|
|
521 | (1) |
|
|
522 | (1) |
|
|
523 | (2) |
|
14 Encryption and Hashing |
|
|
525 | (56) |
|
|
526 | (1) |
|
Introduction to Encryption |
|
|
527 | (24) |
|
|
528 | (1) |
|
|
528 | (1) |
|
Symmetric vs. Asymmetric Encryption |
|
|
529 | (2) |
|
|
531 | (1) |
|
|
532 | (1) |
|
|
532 | (8) |
|
|
540 | (2) |
|
Initialization Vector or Salt |
|
|
542 | (2) |
|
|
544 | (6) |
|
Protecting the Data from the DBA |
|
|
550 | (1) |
|
|
551 | (1) |
|
A Complete Encryption Solution |
|
|
551 | (2) |
|
Option 1: Alter the Table |
|
|
552 | (1) |
|
Option 2: Encrypt the Columns Themselves, and Use the View to Show the Decrypted Data |
|
|
552 | (1) |
|
Store the Keys Separate from the Table |
|
|
553 | (1) |
|
|
553 | (1) |
|
Transparent Data Encryption |
|
|
553 | (6) |
|
|
555 | (1) |
|
Adding TDE to Existing Tables |
|
|
556 | (1) |
|
|
556 | (2) |
|
Performing TDE Key and Password Management |
|
|
558 | (1) |
|
|
558 | (1) |
|
|
559 | (4) |
|
The Case of the Suspicious Sandwich |
|
|
559 | (1) |
|
|
560 | (3) |
|
|
563 | (1) |
|
Message Authentication Code |
|
|
563 | (3) |
|
Putting It All Together: A Project |
|
|
566 | (8) |
|
|
566 | (1) |
|
|
567 | (7) |
|
|
574 | (5) |
|
|
574 | (1) |
|
|
574 | (1) |
|
|
575 | (2) |
|
|
577 | (1) |
|
|
578 | (1) |
|
|
579 | (2) |
|
15 SQL Injection and Code Security |
|
|
581 | (40) |
|
|
582 | (8) |
|
|
590 | (5) |
|
|
591 | (2) |
|
Role-Based Program Security |
|
|
593 | (2) |
|
|
595 | (3) |
|
Restricting Inherited Privilege |
|
|
598 | (4) |
|
|
602 | (18) |
|
Sanitization of the Input String |
|
|
605 | (13) |
|
Reducing SQL Injection Possibilities |
|
|
618 | (2) |
|
|
620 | (1) |
|
16 Fine Grained Access Control and Application Contexts |
|
|
621 | (56) |
|
Introduction to Fine Grained Access Control |
|
|
622 | (4) |
|
|
626 | (1) |
|
|
627 | (1) |
|
|
628 | (3) |
|
|
631 | (14) |
|
Performing an Update Check |
|
|
631 | (2) |
|
Static vs. Dynamic Policies |
|
|
633 | (12) |
|
|
645 | (10) |
|
Controlling the Type of Table Access |
|
|
648 | (4) |
|
|
652 | (3) |
|
Other Classes of Dynamism |
|
|
655 | (3) |
|
|
656 | (1) |
|
|
657 | (1) |
|
Shared Context-Sensitive Policy |
|
|
658 | (1) |
|
|
658 | (3) |
|
ORA-28110: Policy Function or Package Has Error |
|
|
658 | (1) |
|
ORA-28112: Failed to Execute Policy Function |
|
|
658 | (1) |
|
ORA-28113: Policy Predicate Has Error |
|
|
659 | (1) |
|
|
659 | (1) |
|
Checking the Query Rewrite |
|
|
660 | (1) |
|
Interactions with Other Oracle Features |
|
|
661 | (2) |
|
Referential Integrity Constraints |
|
|
661 | (1) |
|
|
662 | (1) |
|
|
662 | (1) |
|
|
663 | (10) |
|
|
664 | (1) |
|
The Security in Application Contexts |
|
|
665 | (1) |
|
Contexts as Predicates in VPD |
|
|
666 | (4) |
|
Identifying Nondatabase Users |
|
|
670 | (3) |
|
|
673 | (1) |
|
|
673 | (3) |
|
|
673 | (2) |
|
|
675 | (1) |
|
|
676 | (1) |
Index |
|
677 | |