Introduction to Oracle: SQL and PL/SQL Using Procedure Builder potx

322 453 1
Introduction to Oracle: SQL and PL/SQL Using Procedure Builder potx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Introduction to Oracle: SQL and PL/SQL Using Procedure Builder Volume One S Participant Guide Edition 1.1 M03989 T1001E11 Authors Neena Kochhar Debby Kramer Technical Contributors and Reviewers Christian Bauwens Debra Bowman Lenny Brunson Jackie Collins Ralf Durben Brian Fry Anthony Holbrook Karlene Jensen Sarah Jones Glenn Maslen Sundar Nagarathnam Sandra Schrick Ulrike Schwinn Rosemarie Truman Jenny Tsai Laura Van Deusen Publishers Stephanie Jones Kimberly Lee Jennifer Robertson Mark Turangan Copyright EĂOracle Corporation, 1992, 1996. All rights reserved. This documentation contains proprietary information of Oracle Corporation; it is provided under a license agreement containing restrictions on use and discloĆ sure and is also protected by copyright law. Reverse engineering of the software is prohibited. If this documentation is delivered to a U.S. Government Agency of the Department of Defense, then it is delivered with Restricted Rights and the folĆ lowing legend is applicable: Restricted Rights Legend Use, duplication or disclosure by the Government is subject to restrictions for commercial computer software and shall be deemed to be Restricted Rights softĆ ware under Federal law, and as set forth in subparagraph (c) (1) (ii) of DFARS 252.227Ć7013, Rights in Technical Data and Computer Software (October 1988). This material or any portion of it may not be copied in any form or by any means without the express prior written permission of the Worldwide Education Services group of Oracle Corporation. Any other copying is a violation of copyright law and may result in civil and/or criminal penalties. If this documentation is delivered to a U.S. Government Agency not within the DeĆ partment of Defense, then it is delivered with Restricted Rights," as defined in FAR 52.227Ć14, Rights in DataĆGeneral, including Alternate III (June 1987). The information in this document is subject to change without notice. If you find any problems in the documentation, please report them in writing to Worldwide Education Services, Oracle Corporation, 500 Oracle Parkway, Box 659806, RedĆ wood Shores, CA 94065. Oracle Corporation doesnot warrant that this document is error free. SQL*Plus, PL/SQL, Procedure Builder, Developer/2000, Oracle7 Server, Oracle Server, Discoverer/2000, and Designer/2000 are trademarks or registered tradeĆ marks of Oracle Corporation. All other products or company names are used for identification purposes only, and may be trademarks of their respective owners. iii Contents Volume 1 Preface xi Profile xii Related Publications xviii Typographic Conventions xix I Introduction IĆ1 Course Objectives IĆ3 Course Outline IĆ5 The Relational Database Concept IĆ9 System Development Cycle IĆ17 What Is Oracle? IĆ19 The Oracle Product Set IĆ21 SQL, SQL*Plus, and PL/SQL IĆ23 Summit Sporting Goods Demonstration Tables IĆ29 Summary IĆ33 1. Selecting Rows 1Ć1 Objectives 1Ć3 The Basic Query Block 1Ć5 Arithmetic Expressions 1Ć13 Column Aliases 1Ć21 The Concatenation Operator 1Ć23 Literal Character String 1Ć25 Managing Null Values 1Ć27 Preventing the Selection of Duplicate Rows 1Ć31 SQL*Plus Commands 1Ć35 Logging in to SQL*Plus 1Ć37 Displaying Table Structure 1Ć39 SQL*Plus Editing Commands 1Ć41 SQL*Plus File Commands and Online Help 1Ć43 Creating a Report 1Ć45 Summary 1Ć51 Practice Overview 1Ć53 Practice 1 1Ć55 2. Limiting Selected Rows 2Ć1 Objectives 2Ć3 Ordering Rows with the ORDER BY Clause 2Ć5 Limiting Selected Rows with the WHERE Clause 2Ć11 Comparison Operators 2Ć13 iv Negating Expressions 2Ć17 SQL Operators 2Ć19 Querying Data with Multiple Conditions 2Ć27 Rules of Precedence 2Ć29 Summary 2Ć33 Practice Overview 2Ć35 Practice 2 2Ć37 3. Single Row Functions 3Ć1 Objectives 3Ć3 Overview 3Ć5 Single Row Functions 3Ć7 Character Functions 3Ć9 Number Functions 3Ć17 Oracle Date Format 3Ć23 Using Arithmetic Operators with Dates 3Ć25 Date Functions 3Ć27 Conversion Functions 3Ć33 TO_CHAR Function with Date Formats 3Ć35 TO_CHAR Function with Number Formats 3Ć45 TO_NUMBER and TO_DATE Functions 3Ć49 Nesting Single Row Functions 3Ć51 Nesting Functions 3Ć53 Summary 3Ć55 Practice Overview 3Ć57 Practice 3 3Ć59 4. Displaying Data from Multiple Tables 4Ć1 Objectives 4Ć3 Overview 4Ć5 What Is a Cartesian Product? 4Ć7 Simple Join Query 4Ć9 Using Table Aliases 4Ć17 NonĆEquijoin 4Ć19 Returning Records with No Direct Match 4Ć21 Joining a Table to Itself 4Ć25 Summary 4Ć27 Practice Overview 4Ć29 Practice 4 4Ć31 5. Group Functions 5Ć1 Objectives 5Ć3 Overview 5Ć5 Group Functions 5Ć7 v The GROUP BY Clause 5Ć13 Illegal Queries Using Group Functions 5Ć19 Groups Within Groups 5Ć23 The HAVING Clause 5Ć25 Summary 5Ć31 Practice Overview 5Ć33 Practice 5 5Ć34 6. Subqueries 6Ć1 Objectives 6Ć3 Overview 6Ć5 Subqueries 6Ć7 How Are Nested Subqueries Processed? 6Ć9 Single Row Subqueries 6Ć11 Errors with Subqueries 6Ć15 Multiple Row Subqueries 6Ć17 HAVING Clause with Nested Subqueries 6Ć19 Summary 6Ć21 Practice Overview 6Ć23 Practice 6 6Ć25 Volume 2 7. Specifying Variables at Runtime 7Ć1 Objectives 7Ć3 Overview 7Ć5 Substitution Variables 7Ć7 Single Ampersand Substitution Variables 7Ć9 Defining User Variables 7Ć15 Passing Values into a Script File 7Ć21 Summary 7Ć23 Practice Overview 7Ć25 Practice 7 7Ć26 8. Overview of Data Modeling and Database Design 8Ć1 Objectives 8Ć3 Overview 8Ć5 System Development Cycle 8Ć7 Database Design 8Ć9 Data Model 8Ć11 Entity Relationship Modeling 8Ć13 Entity Relationship Model Concepts 8Ć15 Integrity Constraints and Keys 8Ć23 Designing the Database 8Ć29 Summary 8Ć39 vi 9. Creating Tables 9Ć1 Objectives 9Ć3 Overview 9Ć5 Creating Tables 9Ć7 Oracle7 Datatypes 9Ć13 Constraints 9Ć15 Creating a Table from a Table Instance Chart 9Ć25 Creating a Table from Rows in Another Table 9Ć31 Confirming Table Creation 9Ć33 Summary 9Ć35 Practice Overview 9Ć37 Practice 9 9Ć39 10. Oracle Data Dictionary 10Ć1 Objectives 10Ć3 Overview 10Ć5 Querying the Data Dictionary 10Ć7 Checking Constraints on a Table 10Ć13 Summary 10Ć17 Practice Overview 10Ć19 Practice 10 10Ć21 11. Manipulating Data 11Ć1 Objectives 11Ć3 Overview 11Ć5 Adding a New Row to a Table 11Ć7 Copying Rows from Another Table 11Ć19 Updating Rows 11Ć21 Deleting Rows 11Ć29 Transaction Processing 11Ć35 Committing Changes 11Ć39 Rolling Back Changes 11Ć43 Rolling Back Changes to a Savepoint 11Ć45 Statement Level Rollback 11Ć47 Summary 11Ć49 Practice Overview 11Ć51 Practice 11 11Ć53 12. Altering Tables and Constraints 12Ć1 Objectives 12Ć3 Overview 12Ć5 Adding a Column 12Ć7 Modifying a Column 12Ć9 Adding and Dropping a Constraint 12Ć11 vii Disabling and Enabling a Constraint 12Ć15 Dropping a Table 12Ć17 Renaming and Truncating a Table 12Ć19 Adding a Comment to a Table 12Ć21 Summary 12Ć23 Practice Overview 12Ć25 Practice 12 12Ć27 13. Creating Sequences 13Ć1 Objectives 13Ć3 Overview 13Ć5 Creating a Sequence 13Ć7 Using a Sequence 13Ć13 Altering a Sequence 13Ć17 Removing a Sequence 13Ć19 Summary 13Ć21 Practice Overview 13Ć23 Practice 13 13Ć25 14. Creating Views 14Ć1 Objectives 14Ć3 Overview 14Ć5 Creating a View 14Ć7 Performing DML Operations on a View 14Ć15 Confirming View Names and Structures 14Ć21 Removing a View 14Ć23 Summary 14Ć25 Practice Overview 14Ć27 Practice 14 14Ć29 15. Creating Indexes 15Ć1 Objectives 15Ć3 Overview 15Ć5 When Is the Index Used? 15Ć7 Index Structure 15Ć9 Creating an Index 15Ć13 Confirming Indexes 15Ć17 Removing an Index 15Ć19 Summary 15Ć21 Practice Overview 15Ć23 Practice 15 15Ć25 16. Controlling User Access 16Ć1 Objectives 16Ć3 Overview 16Ć5 viii System Privileges 16Ć7 What Is a Role? 16Ć11 Changing Your Password 16Ć13 Granting Object Privileges 16Ć15 Confirming Privileges Granted 16Ć21 Revoking Object Privileges 16Ć23 Creating a Synonym for an Object 16Ć25 Summary 16Ć29 Practice Overview 16Ć31 Practice 16 16Ć33 17. Summary of SQL and SQL*Plus 17Ć1 Summary of SQL and SQL*Plus 17Ć3 Practice Overview 17Ć9 Practice 17 17Ć11 Volume 3 18. Overview of PL/SQL 18Ć1 Objectives 18Ć3 Overview 18Ć5 PL/SQL Block Structure 18Ć9 The PL/SQL Environment 18Ć15 About Procedure Builder 18Ć17 19. Basics of Procedure Builder 19Ć1 Objectives 19Ć3 Overview 19Ć5 Oracle Procedure Builder Capabilities 19Ć7 Procedure Builder Components 19Ć9 The Object Navigator 19Ć15 The Interpreter 19Ć23 The Program Unit Editor 19Ć27 The Stored Program Unit Editor 19Ć31 Debugging a Stored Program Unit 19Ć33 Performing Debug Actions in the Interpreter 19Ć35 Setting a Breakpoint 19Ć37 Examining Local Variables 19Ć43 Summary 19Ć45 Practice Overview 19Ć47 Practice 19 19Ć49 20. Modularizing Programming with Subprograms 20Ć1 Objectives 20Ć3 Overview 20Ć5 ix Creating a Subprogram 20Ć7 Creating a Procedure 20Ć9 Comparing Functions and Procedures 20Ć15 Creating a Function 20Ć17 Invoking Subprograms 20Ć21 Summary 20Ć29 Practice Overview 20Ć31 Practice 20 20Ć33 21. Developing a Simple PL/SQL Block 21Ć1 Objectives 21Ć3 Overview 21Ć5 Declaring PL/SQL Variables and Constants 21Ć7 Declaring Scalar Variables 21Ć9 Declaring Composite Datatypes 21Ć15 PL/SQL Block Syntax Rules 21Ć25 Assigning Values to Variables 21Ć29 Programming Guidelines 21Ć43 Summary 21Ć49 Practice Overview 21Ć51 Practice 21 21Ć53 22. Interacting with Oracle 22Ć1 Objectives 22Ć3 Overview 22Ć5 Retrieving Data Using PL/SQL 22Ć7 SELECT Exceptions 22Ć15 Manipulating Data Using PL/SQL 22Ć19 SQL Cursor 22Ć23 Controlling Transactions 22Ć27 Summary 22Ć31 Practice Overview 22Ć33 Practice 22 22Ć35 23. Controlling Flow in PL/SQL Blocks 23Ć1 Objectives 23Ć3 Overview 23Ć5 The IF Statement 23Ć7 Building Logical Conditions 23Ć13 Loop Statements 23Ć17 Summary 23Ć29 Practice Overview 23Ć31 Practice 23 23Ć33 x 24. Processing Queries by Using Explicit Cursors 24Ć1 Objectives 24Ć3 Overview 24Ć5 Controlling Explicit Cursors 24Ć7 Explicit Cursor Attributes 24Ć17 Cursors and Records 24Ć21 Cursors with Parameters 24Ć23 Cursor FOR Loops 24Ć25 Applying the WHERE CURRENT OF Clause 24Ć27 Summary 24Ć29 Practice Overview 24Ć31 Practice 24 24Ć33 25. Error Handling 25Ć1 Objectives 25Ć3 Overview 25Ć5 Exception Types 25Ć7 Trapping Exceptions 25Ć9 Trapping Predefined Oracle7 Server Exceptions 25Ć11 Trapping NonĆPredefined Oracle7 Server Exceptions 25Ć15 Trapping UserĆDefined Exceptions 25Ć17 Error Trapping Functions 25Ć19 Propagating Exceptions 25Ć21 Summary 25Ć23 Practice Overview 25Ć25 Practice 25 25Ć27 26. Summary of PL/SQL 26Ć1 Summary 26Ć3 Practice Overview 26Ć9 Practice 26 26Ć11 Volume 4 A Practice Solutions AĆ1 Preface AĆ3 Practice 1 Solutions AĆ4 Practice 2 Solutions AĆ8 Practice 3 Solutions AĆ20 Practice 4 Solutions AĆ29 Practice 5 Solutions AĆ39 Practice 6 Solutions AĆ46 Practice 7 Solutions AĆ55 Practice 9 Solutions AĆ59 Practice 10 Solutions AĆ63 [...]... of PL /SQL Overview lesson of how to create and use PL /SQL program units and subprograms using Oracle Procedure Builder Lesson 19: Basics of Procedure Builder A key feature of procedural programming is the ability to create and debug code quickly and easily Procedure Builder provides all of the functionality necessary for you to successfully develop and debug PL /SQL programs This lesson enables you to. .. the database and control transactions through SQL statements in PL /SQL xviii Introduction to Oracle: SQL and PL /SQL Using Procedure Builder Profile continued Lesson Aim Lesson 23: Using Control Structures Control the flow of your PL /SQL block by using conditional statements and loops Lesson 24: Processing Queries with Use a multiple row SELECT statement Explicit Cursors within PL /SQL to process many... database D Develop PL /SQL blocks of application code using Procedure Builder to manipulate data Introduction IĆ3 IĆ4 Introduction to Oracle: SQL and PL /SQL Using Procedure Builder Course Outline The course starts with an overview The first module ends on Day 3 with an optional summary covering the SQL and SQL* Plus content The second module ends on Day 5 with an optional summary of the PL /SQL section DAY... SQL and PL /SQL Using Procedure Builder I Introduction IĆ2 Introduction to Oracle: SQL and PL /SQL Using Procedure Builder Course Objectives At the end of this course, you should be able to D Describe the relational database approach, concepts, terminology, and operators D Create database structures such as tables and views using Structured Query Language (SQL) D Store, retrieve, and update data in the... of PL /SQL Lesson 19 Basics of Procedure Builder Lesson 20 Modularizing Programming with Subprograms Lesson 21 Developing a Simple PL /SQL Block Lesson 22 Interacting with Oracle DAY 5 Lesson 23 Controlling Flow in PL /SQL Blocks Lesson 24 Processing Queries by Using Explicit Cursors Lesson 25 Error Handling Lesson 26 Summary of PL /SQL (optional) Introduction IĆ7 IĆ8 Introduction to Oracle: SQL and PL /SQL. .. (SQL) SELECT command You will want to create SELECT statements that you can use time and time again You will also see how to save your statements for later use Lesson 2: Limiting Selected Rows xiv This lesson will cover how to restrict the rows and columns that are displayed, as well as how to specify the order in which the rows are presented Introduction to Oracle: SQL and PL /SQL Using Procedure Builder. .. concepts and techniques How This Course Is Organized Introduction to Oracle: SQL and PL /SQL Using Procedure Builder is an instructor-led course featuring lecture and hands-on exercises The concepts and skills introduced are reinforced by online demonstrations and written practice sessions How This Book Is Organized Lesson Aim Lesson 1: Selecting Rows In order to extract data from the database you need to. .. manipulate PL /SQL code using Procedure Builder Lesson 20: Modularizing Programming with Subprograms Modularity allows you to break your code into manageable, well-defined units Each of these units in PL /SQL has two types of subprograms called procedures and functions You will learn the structure of subprograms and how to invoke them Lesson 21: Developing a Simple PL /SQL Block Create a simple PL /SQL block... Modeling and Database Design Lesson 9 Creating Tables Lesson 10 Oracle Data Dictionary DAY 3 Lesson 11 Manipulating Data Lesson 12 Altering Tables and Constraints Lesson 13 Creating Sequences Lesson 14 Creating Views Lesson 15 Creating Indexes Lesson 16 Controlling User Access Lesson 17 Summary of SQL and SQL* Plus (optional) Introduction IĆ5 IĆ6 Introduction to Oracle: SQL and PL /SQL Using Procedure Builder. .. BĆ22 BĆ25 BĆ26 Using SQL* Plus to Create Reports and Manage PL /SQL Code CĆ1 Objectives Overview Entering Commands in SQL* Plus Comparison of SQL and SQL* Plus Commands SQL* Plus SET Commands . for objects by using the CREATE SYNONYM command. Introduction to Oracle: SQL and PL /SQL Using Procedure Builderxviii Profile continued Lesson Aim Lesson 17: Summary of SQL and SQL* Plus (optional) This. C Using SQL* Plus to Create Reports and Manage PL /SQL Code CĆ1 Objectives CĆ3 Overview CĆ5 Entering Commands in SQL* Plus CĆ7 Comparison of SQL and SQL* Plus Commands CĆ9 SQL* Plus SET Commands. in the course. Create a PL /SQL- based application for manipulating and maintaining information in your database. Introduction to Oracle: SQL and PL /SQL Using Procedure Builderxx Related Publications Oracle

Ngày đăng: 02/07/2014, 00:20

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan