SQL and PL/SQL Using Procedure Buider

322 361 0
SQL and PL/SQL Using Procedure Buider

Đ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 Copyright EĂOracle Corporation, 1992, 1996 All rights reserved Neena Kochhar Debby Kramer 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: Technical Contributors and Reviewers Restricted Rights Legend 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 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 does not 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 Publishers Stephanie Jones Kimberly Lee Jennifer Robertson Mark Turangan Contents Volume Preface Profile Related Publications Typographic Conventions I xi xii xviii xix Introduction IĆ1 Course Objectives Course Outline The Relational Database Concept System Development Cycle What Is Oracle? The Oracle Product Set SQL, SQL*Plus, and PL/SQL Summit Sporting Goods Demonstration Tables Summary IĆ3 IĆ5 IĆ9 IĆ17 IĆ19 IĆ21 IĆ23 IĆ29 IĆ33 Selecting Rows 1Ć1 Objectives The Basic Query Block Arithmetic Expressions Column Aliases The Concatenation Operator Literal Character String Managing Null Values Preventing the Selection of Duplicate Rows SQL*Plus Commands Logging in to SQL*Plus Displaying Table Structure SQL*Plus Editing Commands SQL*Plus File Commands and Online Help Creating a Report Summary Practice Overview Practice 1Ć3 1Ć5 1Ć13 1Ć21 1Ć23 1Ć25 1Ć27 1Ć31 1Ć35 1Ć37 1Ć39 1Ć41 1Ć43 1Ć45 1Ć51 1Ć53 1Ć55 Limiting Selected Rows 2Ć1 Objectives Ordering Rows with the ORDER BY Clause Limiting Selected Rows with the WHERE Clause Comparison Operators 2Ć3 2Ć5 2Ć11 2Ć13 iii Negating Expressions SQL Operators Querying Data with Multiple Conditions Rules of Precedence Summary Practice Overview Practice 2Ć17 2Ć19 2Ć27 2Ć29 2Ć33 2Ć35 2Ć37 Single Row Functions 3Ć1 Objectives Overview Single Row Functions Character Functions Number Functions Oracle Date Format Using Arithmetic Operators with Dates Date Functions Conversion Functions TO_CHAR Function with Date Formats TO_CHAR Function with Number Formats TO_NUMBER and TO_DATE Functions Nesting Single Row Functions Nesting Functions Summary Practice Overview Practice 3Ć3 3Ć5 3Ć7 3Ć9 3Ć17 3Ć23 3Ć25 3Ć27 3Ć33 3Ć35 3Ć45 3Ć49 3Ć51 3Ć53 3Ć55 3Ć57 3Ć59 Displaying Data from Multiple Tables 4Ć1 Objectives Overview What Is a Cartesian Product? Simple Join Query Using Table Aliases NonĆEquijoin Returning Records with No Direct Match Joining a Table to Itself Summary Practice Overview Practice 4Ć3 4Ć5 4Ć7 4Ć9 4Ć17 4Ć19 4Ć21 4Ć25 4Ć27 4Ć29 4Ć31 Group Functions 5Ć1 Objectives Overview Group Functions 5Ć3 5Ć5 5Ć7 iv The GROUP BY Clause Illegal Queries Using Group Functions Groups Within Groups The HAVING Clause Summary Practice Overview Practice 5Ć13 5Ć19 5Ć23 5Ć25 5Ć31 5Ć33 5Ć34 Subqueries 6Ć1 Objectives Overview Subqueries How Are Nested Subqueries Processed? Single Row Subqueries Errors with Subqueries Multiple Row Subqueries HAVING Clause with Nested Subqueries Summary Practice Overview Practice 6Ć3 6Ć5 6Ć7 6Ć9 6Ć11 6Ć15 6Ć17 6Ć19 6Ć21 6Ć23 6Ć25 Volume Specifying Variables at Runtime 7Ć1 Objectives Overview Substitution Variables Single Ampersand Substitution Variables Defining User Variables Passing Values into a Script File Summary Practice Overview Practice 7Ć3 7Ć5 7Ć7 7Ć9 7Ć15 7Ć21 7Ć23 7Ć25 7Ć26 Overview of Data Modeling and Database Design 8Ć1 Objectives Overview System Development Cycle Database Design Data Model Entity Relationship Modeling Entity Relationship Model Concepts Integrity Constraints and Keys Designing the Database Summary 8Ć3 8Ć5 8Ć7 8Ć9 8Ć11 8Ć13 8Ć15 8Ć23 8Ć29 8Ć39 v Creating Tables 9Ć1 Objectives Overview Creating Tables Oracle7 Datatypes Constraints Creating a Table from a Table Instance Chart Creating a Table from Rows in Another Table Confirming Table Creation Summary Practice Overview Practice 9Ć3 9Ć5 9Ć7 9Ć13 9Ć15 9Ć25 9Ć31 9Ć33 9Ć35 9Ć37 9Ć39 10 Oracle Data Dictionary 10Ć1 Objectives Overview Querying the Data Dictionary Checking Constraints on a Table Summary Practice Overview Practice 10 10Ć3 10Ć5 10Ć7 10Ć13 10Ć17 10Ć19 10Ć21 11 Manipulating Data 11Ć1 Objectives Overview Adding a New Row to a Table Copying Rows from Another Table Updating Rows Deleting Rows Transaction Processing Committing Changes Rolling Back Changes Rolling Back Changes to a Savepoint Statement Level Rollback Summary Practice Overview Practice 11 11Ć3 11Ć5 11Ć7 11Ć19 11Ć21 11Ć29 11Ć35 11Ć39 11Ć43 11Ć45 11Ć47 11Ć49 11Ć51 11Ć53 12 Altering Tables and Constraints 12Ć1 Objectives Overview Adding a Column Modifying a Column Adding and Dropping a Constraint 12Ć3 12Ć5 12Ć7 12Ć9 12Ć11 vi Disabling and Enabling a Constraint Dropping a Table Renaming and Truncating a Table Adding a Comment to a Table Summary Practice Overview Practice 12 12Ć15 12Ć17 12Ć19 12Ć21 12Ć23 12Ć25 12Ć27 13 Creating Sequences 13Ć1 Objectives Overview Creating a Sequence Using a Sequence Altering a Sequence Removing a Sequence Summary Practice Overview Practice 13 13Ć3 13Ć5 13Ć7 13Ć13 13Ć17 13Ć19 13Ć21 13Ć23 13Ć25 14 Creating Views 14Ć1 Objectives Overview Creating a View Performing DML Operations on a View Confirming View Names and Structures Removing a View Summary Practice Overview Practice 14 14Ć3 14Ć5 14Ć7 14Ć15 14Ć21 14Ć23 14Ć25 14Ć27 14Ć29 15 Creating Indexes 15Ć1 Objectives Overview When Is the Index Used? Index Structure Creating an Index Confirming Indexes Removing an Index Summary Practice Overview Practice 15 15Ć3 15Ć5 15Ć7 15Ć9 15Ć13 15Ć17 15Ć19 15Ć21 15Ć23 15Ć25 16 Controlling User Access 16Ć1 Objectives Overview 16Ć3 16Ć5 vii System Privileges What Is a Role? Changing Your Password Granting Object Privileges Confirming Privileges Granted Revoking Object Privileges Creating a Synonym for an Object Summary Practice Overview Practice 16 16Ć7 16Ć11 16Ć13 16Ć15 16Ć21 16Ć23 16Ć25 16Ć29 16Ć31 16Ć33 17 Summary of SQL and SQL*Plus 17Ć1 Summary of SQL and SQL*Plus Practice Overview Practice 17 17Ć3 17Ć9 17Ć11 Volume 18 Overview of PL/SQL 18Ć1 Objectives Overview PL/SQL Block Structure The PL/SQL Environment About Procedure Builder 18Ć3 18Ć5 18Ć9 18Ć15 18Ć17 19 Basics of Procedure Builder 19Ć1 Objectives Overview Oracle Procedure Builder Capabilities Procedure Builder Components The Object Navigator The Interpreter The Program Unit Editor The Stored Program Unit Editor Debugging a Stored Program Unit Performing Debug Actions in the Interpreter Setting a Breakpoint Examining Local Variables Summary Practice Overview Practice 19 19Ć3 19Ć5 19Ć7 19Ć9 19Ć15 19Ć23 19Ć27 19Ć31 19Ć33 19Ć35 19Ć37 19Ć43 19Ć45 19Ć47 19Ć49 20 Modularizing Programming with Subprograms 20Ć1 Objectives Overview 20Ć3 20Ć5 viii Creating a Subprogram Creating a Procedure Comparing Functions and Procedures Creating a Function Invoking Subprograms Summary Practice Overview Practice 20 20Ć7 20Ć9 20Ć15 20Ć17 20Ć21 20Ć29 20Ć31 20Ć33 21 Developing a Simple PL/SQL Block 21Ć1 Objectives Overview Declaring PL/SQL Variables and Constants Declaring Scalar Variables Declaring Composite Datatypes PL/SQL Block Syntax Rules Assigning Values to Variables Programming Guidelines Summary Practice Overview Practice 21 21Ć3 21Ć5 21Ć7 21Ć9 21Ć15 21Ć25 21Ć29 21Ć43 21Ć49 21Ć51 21Ć53 22 Interacting with Oracle 22Ć1 Objectives Overview Retrieving Data Using PL/SQL SELECT Exceptions Manipulating Data Using PL/SQL SQL Cursor Controlling Transactions Summary Practice Overview Practice 22 22Ć3 22Ć5 22Ć7 22Ć15 22Ć19 22Ć23 22Ć27 22Ć31 22Ć33 22Ć35 23 Controlling Flow in PL/SQL Blocks 23Ć1 Objectives Overview The IF Statement Building Logical Conditions Loop Statements Summary Practice Overview Practice 23 23Ć3 23Ć5 23Ć7 23Ć13 23Ć17 23Ć29 23Ć31 23Ć33 ix 24 Processing Queries by Using Explicit Cursors 24Ć1 Objectives Overview Controlling Explicit Cursors Explicit Cursor Attributes Cursors and Records Cursors with Parameters Cursor FOR Loops Applying the WHERE CURRENT OF Clause Summary Practice Overview Practice 24 24Ć3 24Ć5 24Ć7 24Ć17 24Ć21 24Ć23 24Ć25 24Ć27 24Ć29 24Ć31 24Ć33 25 Error Handling 25Ć1 Objectives Overview Exception Types Trapping Exceptions Trapping Predefined Oracle7 Server Exceptions Trapping NonĆPredefined Oracle7 Server Exceptions Trapping UserĆDefined Exceptions Error Trapping Functions Propagating Exceptions Summary Practice Overview Practice 25 25Ć3 25Ć5 25Ć7 25Ć9 25Ć11 25Ć15 25Ć17 25Ć19 25Ć21 25Ć23 25Ć25 25Ć27 26 Summary of PL/SQL 26Ć1 Summary Practice Overview Practice 26 26Ć3 26Ć9 26Ć11 Volume A x Practice Solutions AĆ1 Preface Practice Solutions Practice Solutions Practice Solutions Practice Solutions Practice Solutions Practice Solutions Practice Solutions Practice Solutions Practice 10 Solutions AĆ3 AĆ4 AĆ8 AĆ20 AĆ29 AĆ39 AĆ46 AĆ55 AĆ59 AĆ63 ... 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... 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. .. far Lesson 18: Overview 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

Ngày đăng: 19/10/2013, 11:15

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