PL/SQL User's Guide and Reference

PL/SQL User's Guide and Reference

PL/SQL User’s Guide and Reference Release 2 (9.2) March 2002 Part No. A96624-01 PL/SQL User’s Guide and Reference, Release 2 (9.2) Part No. A96624-01 Copyright © 1996, 2002 Oracle Corporation. All rights reserved. Primary Author: John Russell Contributing Author: Tom Portfolio Contributors: Shashaanka Agrawal, Cailein Barclay, Dmitri Bronnikov, Sharon Castledine, Thomas Chang, Ravindra Dani, Chandrasekharan Iyer, Susan Kotsovolos, Neil Le, Warren Li, Chris Racicot, Murali Vemulapati, Guhan Viswanathan, Minghui Yang The Programs (which include both the software and documentation) contain proprietary information of Oracle Corporation; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright, patent and other intellectual and industrial property laws. Reverse engineering, disassembly or decompilation of the Programs, except to the extent required to obtain interoperability with other independently created software or as specified by law, is prohibited. The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. Oracle Corporation does not warrant that this document is error-free. Except as may be expressly permitted in your license agreement for these Programs, no part of these Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Oracle Corporation. If the Programs are delivered to the U.S. Government or anyone licensing or using the programs on behalf of the U.S. Government, the following notice is applicable: Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercial computer software" and use, duplication, and disclosure of the Programs, including documentation, shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement. Otherwise, Programs delivered subject to the Federal Acquisition Regulations are "restricted computer software" and use, duplication, and disclosure of the Programs shall be subject to the restrictions in FAR 52.227-19, Commercial Computer Software - Restricted Rights (June, 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065. The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of such applications if the Programs are used for such purposes, and Oracle Corporation disclaims liability for any damages caused by such use of the Programs. Oracle is a registered trademark, and Oracle Store, Oracle9i, PL/SQL, Pro*C, and SQL*Plus are trademarks or registered trademarks of Oracle Corporation. Other names may be trademarks of their respective owners. Contents Send Us Your Comments ................................................................................................................. xix Preface.......................................................................................................................................................... xxi What’s New in PL/SQL?................................................................................................................... xxxi 1 Overview of PL/SQL Understanding the Main Features of PL/SQL............................................................................... 1-2 Block Structure.............................................................................................................................. 1-2 Variables and Constants .............................................................................................................. 1-3 Cursors ........................................................................................................................................... 1-5 Cursor FOR Loops........................................................................................................................ 1-6 Cursor Variables ........................................................................................................................... 1-6 Attributes ....................................................................................................................................... 1-7 Control Structures ........................................................................................................................ 1-9 Modularity................................................................................................................................... 1-12 Data Abstraction ......................................................................................................................... 1-14 Information Hiding .................................................................................................................... 1-16 Error Handling............................................................................................................................ 1-16 PL/SQL Architecture ........................................................................................................................ 1-17 In the Oracle Database Server................................................................................................... 1-18 In Oracle Tools ............................................................................................................................ 1-20 Advantages of PL/SQL..................................................................................................................... 1-20 Support for SQL.......................................................................................................................... 1-20 iii Support for Object-Oriented Programming............................................................................ 1-21 Better Performance ..................................................................................................................... 1-21 Higher Productivity.................................................................................................................... 1-22 Full Portability............................................................................................................................. 1-23 Tight Integration with SQL ....................................................................................................... 1-23 Tight Security .............................................................................................................................. 1-23 2 Fundamentals of PL/SQL Character Set ........................................................................................................................................ 2-2 Lexical Units......................................................................................................................................... 2-2 Delimiters....................................................................................................................................... 2-3 Identifiers ....................................................................................................................................... 2-4 Literals ............................................................................................................................................ 2-7 Comments.................................................................................................................................... 2-10 Declarations ....................................................................................................................................... 2-11 Using DEFAULT......................................................................................................................... 2-12 Using NOT NULL....................................................................................................................... 2-13 Using %TYPE .............................................................................................................................. 2-13 Using %ROWTYPE..................................................................................................................... 2-14 Restrictions on Declarations...................................................................................................... 2-17 PL/SQL Naming Conventions........................................................................................................ 2-17 Scope and Visibility of PL/SQL Identifiers ................................................................................. 2-19 Variable Assignment ........................................................................................................................ 2-22 Assigning Boolean Values ......................................................................................................... 2-22 Assigning a SQL Query Result to a PL/SQL Variable.......................................................... 2-23 PL/SQL Expressions and Comparisons ........................................................................................ 2-23 Logical Operators........................................................................................................................ 2-25 Boolean Expressions................................................................................................................... 2-28 CASE Expressions......................................................................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    706 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us