Tài liệu Oracle9i : Program with PL/SQL pdf

529 498 1
Tài liệu Oracle9i : Program with PL/SQL pdf

Đ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

Oracle9i: Program with PL/SQL Electronic Presentation 40054GC11 Production 1.1 October 2001 D34010 Copyright © Oracle Corporation, 1999, 2000, 2001. All rights reserved. This documentation contains proprietary information of Oracle Corporation. It is provided under a license agreement containing restrictions on use and disclosure 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 following 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 software under Federal law, 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 formor by any means without the express prior written permission of the Education Products group of Orac le 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 Department 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, 500Oracle Parkway, Box SB-6, Redwood Shores, CA 94065. Oracle Corporation does not warrant that this document is error-free. Oracle and all references to Oracle Products are trademarks or registered trademarks of Oracle Corporation. All other products or company names are used for identification purposes only, and may be trademarks of their respective owners. Authors Nagavalli Pataballa Priya Nathan Technical Contributors and Reviewers Anna Atkinson Bryan Roberts Caroline Pereda Cesljas Zarco Coley William Daniel Gabel Dr. Christoph Burandt Hakan Lindfors Helen Robertson John Hoff Lachlan Williams Laszlo Czinkoczki Laura Pezzini Linda Boldt Marco Verbeek Natarajan Senthil Priya Vennapusa RogerAbuzalaf Ruediger Steffan Sarah Jones Stefan Lindblad Susan Dee Publisher SherylDomingue Copyright © Oracle Corporation, 2001. All rights reserved. Curriculum Map Copyright © Oracle Corporation, 2001. All rights reserved. Languages Curriculum for Oracle9i Introduction to Oracle9i for Experienced SQL Users inClass Oracle9i: Advanced PL/SQL inClass Oracle9i: Advanced PL/SQL inClass Oracle9i: SQL for End Users inClass Oracle9i: SQL for End Users inClass Oracle9i: Program with PL/SQL inClass Oracle9i: Develop PL/SQL Program Units Oracle9i: Develop PL/SQL Program Units Oracle9i: PL/SQL Fundamentals or Introduction to Oracle9i: SQL Basics Introduction to Oracle9i: SQL inClass Oracle9i: Advanced SQL I Copyright © Oracle Corporation, 2001. All rights reserved. Overview of PL/SQL Copyright © Oracle Corporation, 2001. All rights reserved. I-2 Course Objectives Course Objectives After completing this course, you should be able to do the following: • Describe the purpose of PL/SQL • Describe the use of PL/SQL for the developer as well as the DBA • Explain the benefits of PL/SQL • Create, execute, and maintain procedures, functions, packages, and database triggers • Manage PL/SQL subprograms and triggers • Describe Oracle supplied packages • Manipulate large objects (LOBs) After completing this course, you should be able to do the following: • Describe the purpose of PL/SQL • Describe the use of PL/SQL for the developer as well as the DBA • Explain the benefits of PL/SQL • Create, execute, and maintain procedures, functions, packages, and database triggers • Manage PL/SQL subprograms and triggers • Describe Oracle supplied packages • Manipulate large objects (LOBs) Copyright © Oracle Corporation, 2001. All rights reserved. I-3 About PL/SQL About PL/SQL • PL/SQL is the procedural extension to SQL with design features of programming languages. • Data manipulation and query statements of SQL are included within procedural units of code. • PL/SQL is the procedural extension to SQL with design features of programming languages. • Data manipulation and query statements of SQL are included within procedural units of code. Copyright © Oracle Corporation, 2001. All rights reserved. I-4 PL/SQL Environment PL/SQL Environment PL/SQL block PL/SQL engine Oracle server Procedural statement executor PL/SQL SQL SQL statement executor PL/SQL block Copyright © Oracle Corporation, 2001. All rights reserved. I-5 Benefits of PL/SQL Benefits of PL/SQL Integration Integration Application Oracle server Shared library Copyright © Oracle Corporation, 2001. All rights reserved. I-6 Benefits of PL/SQL Benefits of PL/SQL Improved performance Improved performance Application Other DBMSs Application Oracle with PL/SQL SQL SQL SQL SQL SQL IF THEN SQL ELSE SQL END IF; SQL [...]... 1-9 Non -PL/SQL variables: Bind and host variables Non -PL/SQL variables: Bind and host variables Copyright © Oracle Corporation, 2001 All rights reserved Using iSQL*Plus Variables Within PL/SQL Using iSQL*Plus Variables Within PL/SQL Blocks Blocks • • • • You can reference substitution variables within a You can reference substitution variables within a PL/SQL block with a preceding ampersand PL/SQL. .. following: do the following: • Recognize the basic PL/SQL block and its sections • Recognize the basic PL/SQL block and its sections • • • • • • 1-2 Describe the significance of variables in PL/SQL Describe the significance of variables in PL/SQL Declare PL/SQL variables Declare PL/SQL variables Execute a PL/SQL block Execute a PL/SQL block Copyright © Oracle Corporation, 2001 All rights reserved PL/SQL. .. Summary • • • • • • PL/SQL is an extension to SQL PL/SQL is an extension to SQL Blocks of PL/SQL code are passed to and Blocks of PL/SQL code are passed to and processed by a PL/SQL engine processed by a PL/SQL engine Benefits of PL/SQL: Benefits of PL/SQL: – – – – – – – – • • • • I-12 Integration Integration Improved performance Improved performance Portability Portability Modularity of program development... reserved Declaring PL/SQL Variables Declaring PL/SQL Variables Syntax: Syntax: identifier [CONSTANT] datatype [NOT NULL] [:= | DEFAULT expr]; Examples: Examples: DECLARE v_hiredate v_deptno v_location c_comm 1-12 DATE; NUMBER(2) NOT NULL := 10; VARCHAR2(13) := 'Atlanta'; CONSTANT NUMBER := 1400; Copyright © Oracle Corporation, 2001 All rights reserved Guidelines for Declaring PL/SQL Variables Guidelines... convention for PL/SQL identifiers: for example, v_employee_id Copyright © Oracle Corporation, 2001 All rights reserved Variable Initialization and Keywords Variable Initialization and Keywords • • • • • • Assignment operator (:= ) Assignment operator (:= ) DEFAULT keyword DEFAULT keyword NOT NULL constraint NOT NULL constraint Syntax: Syntax: identifier := expr; Examples: Examples: v_hiredate := '01-JAN-2001';... of PL/SQL Benefits of PL/SQL Modularize program development Modularize program development … … … DECLARE BEGIN EXCEPTION END; I-7 Copyright © Oracle Corporation, 2001 All rights reserved Benefits of PL/SQL Benefits of PL/SQL • • • • I-8 PL/SQL is portable PL/SQL is portable You can declare variables You can declare variables Copyright © Oracle Corporation, 2001 All rights reserved Benefits of PL/SQL. .. Corporation, 2001 All rights reserved Benefits of PL/SQL Benefits of PL/SQL • • • • I-9 You can program with procedural language You can program with procedural language control structures control structures PL/SQL can handle errors PL/SQL can handle errors Copyright © Oracle Corporation, 2001 All rights reserved Benefits of Subprograms • • • • I-10 Easy maintenance Improved data security and integrity... performance Portability Portability Modularity of program development Modularity of program development Subprograms are named PL/SQL blocks, declared Subprograms are named PL/SQL blocks, declared as either procedures or functions as either procedures or functions You can invoke subprograms from different You can invoke subprograms from different environments environments Copyright © Oracle Corporation,... TIMESTAMP WITH WITH WITH WITH TIME ZONE TIME ZONE LOCAL TIME ZONE LOCAL TIME ZONE INTERVAL YEAR TO MONTH INTERVAL YEAR TO MONTH INTERVAL DAY TO SECOND INTERVAL DAY TO SECOND Copyright © Oracle Corporation, 2001 All rights reserved Scalar Variable Declarations Scalar Variable Declarations Examples: Examples: DECLARE v_job v_count v_total_sal v_orderdate c_tax_rate v_valid 1-22 VARCHAR2(9); BINARY_INTEGER := ... variables in the executable section section Pass values into PL/SQL blocks through Pass values into PL/SQL blocks through parameters parameters View results through output variables View results through output variables Copyright © Oracle Corporation, 2001 All rights reserved Types of Variables Types of Variables • • PL/SQL variables: PL/SQL variables: – Scalar – Scalar – Composite – Composite – Reference . inClass Oracle9i: SQL for End Users inClass Oracle9i: Program with PL/SQL inClass Oracle9i: Develop PL/SQL Program Units Oracle9i: Develop PL/SQL Program. for Oracle9i Introduction to Oracle9i for Experienced SQL Users inClass Oracle9i: Advanced PL/SQL inClass Oracle9i: Advanced PL/SQL inClass Oracle9i: SQL

Ngày đăng: 22/01/2014, 11:20

Từ khóa liên quan

Mục lục

  • cover

  • curriculum map

  • introduction

  • lesson 1

  • lesson 2

  • lesson 3

  • lesson 4

  • lesson 5

  • lesson 6

  • lesson 7

  • lesson 8

  • lesson 9

  • lesson 10

  • lesson 11

  • lesson 12

  • lesson 13

  • lesson 14

  • lesson 15

  • lesson 16

  • lesson 17

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

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

Tài liệu liên quan