1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu Oracle Database Reference doc

1,8K 436 0

Đ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

Thông tin cơ bản

Định dạng
Số trang 1.808
Dung lượng 21,36 MB

Nội dung

Oracle® Database SQL Reference 10g Release 1 (10.1) Part No. B10759-01 December 2003 Oracle Database SQL Reference 10g Release 1 (10.1) Part No. B10759-01 Copyright © 1996, 2003 Oracle Corporation. All rights reserved. Primary Authors: Diana Lorentz, Joan Gregoire Contributors: Sundeep Abraham, Angela Amor, Rick Anderson, Vikas Arora, Hermann Baer, Cathy Baird, Anand Baldalker, Cailein Barclay, Ruth Baylis, Eric Belden, Paula Bingham, Tolga Bozkaya, Mark Callaghan, Thomas Chang, Dinesh Das, Souri Das, Jay Davison, Mark Dilman, Mike Feng, Ray Guzman, John Haydu, Wei Hu, Ken Jacobs, Bob Jenkins, Vishy Karra, Thomas Keefe, Jonathan Klein, Vasudha Krishnaswamy, Goutam Kulkarni, Poojan Kumar, Bill Lee, Geoff Lee, Yunrui Li, Likuo Lin, Peter Linsley, Rich Long, Catherine Luu, Qianrong Ma, Vineet Marwah, Susan Mavris, Steve McGee, Michael Moeller, Tony Morales, Ari Mozes, Gopal Mulagund, Sujatha Muthulingam, Muthu Olaggapan, Ananth Raghavan, Jack Raitto, Anitha Ramarao, Siva Ravada, Viv Schupmann, Shrikanth Shankar, Vikram Shukla, Bipul Sinha, Mike Stewart, Sankar Subramanian, Seema Sundara, Andreas Sundquist, Hal Takahara, Ashish Thusoo, Rama Vissapragada, Steve Wertheimer, Andy Witkowski, Daniel Wong, Min Xiao, Aravind Yalamanchi, Wanli Yang, Qin Yu, Tim Yu, Fred Zemke, Weiran Zhang 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 Oracle7, Oracle8, Oracle8i, Oracle9i, Oracle Store, PL/SQL, Pro*C/C++, Pro*COBOL, SQL*Plus, and iSQL*Plus are trademarks or registered trademarks of Oracle Corporation. Other names may be trademarks of their respective owners. iii Contents Send Us Your Comments xxiii Preface . xxv Audience xxv Organization xxv Related Documentation . xxvii Conventions xxviii Documentation Accessibility . xxxi What's New in the SQL Reference? . xxxiii Oracle Database 10g New Features in the SQL Reference . xxxiii 1 Introduction to Oracle SQL History of SQL 1-1 SQL Standards 1-2 How SQL Works 1-2 Common Language for All Relational Databases 1-3 Recent Enhancements 1-3 Nonstandard SQL . 1-4 Recursive SQL . 1-5 Lexical Conventions . 1-5 Tools Support 1-5 iv 2 Basic Elements of Oracle SQL Datatypes . 2-1 Oracle Built-in Datatypes 2-7 CHAR Datatype 2-10 NCHAR Datatype . 2-11 NVARCHAR2 Datatype 2-11 VARCHAR2 Datatype . 2-12 VARCHAR Datatype . 2-12 NUMBER Datatype 2-12 Scale and Precision 2-13 Negative Scale 2-14 Scale Greater than Precision 2-14 Floating-Point Numbers 2-14 BINARY_FLOAT 2-15 BINARY_DOUBLE . 2-15 Numeric Precedence 2-17 DATE Datatype . 2-20 Using Julian Days . 2-23 TIMESTAMP Datatype 2-23 TIMESTAMP WITH TIME ZONE Datatype 2-24 TIMESTAMP WITH LOCAL TIME ZONE Datatype . 2-25 INTERVAL YEAR TO MONTH Datatype 2-26 INTERVAL DAY TO SECOND Datatype . 2-26 Datetime/Interval Arithmetic 2-27 Support for Daylight Saving Times . 2-29 Datetime and Interval Example . 2-30 RAW and LONG RAW Datatypes . 2-30 BFILE Datatype . 2-35 BLOB Datatype . 2-36 CLOB Datatype . 2-36 NCLOB Datatype 2-36 Restricted Rowids . 2-37 Extended Rowids 2-37 Compatibility and Migration 2-38 UROWID Datatype 2-38 v ANSI, DB2, and SQL/DS Datatypes . 2-39 User-Defined Types . 2-41 Object Types 2-41 REFs 2-42 Varrays . 2-42 Nested Tables 2-42 Oracle-Supplied Types . 2-43 Any Types . 2-43 SYS.ANYTYPE . 2-44 SYS.ANYDATA . 2-44 SYS.ANYDATASET 2-44 XML Types 2-44 XMLType . 2-44 URI Datatypes . 2-45 URIFactory Package 2-46 Spatial Types 2-47 SDO_GEOMETRY . 2-47 SDO_GEORASTER . 2-47 Media Types . 2-48 ORDAudio . 2-48 ORDImage . 2-48 ORDImageSignature 2-48 ORDVideo . 2-48 ORDDoc . 2-49 SI_StillImage 2-49 SI_Color 2-49 SI_AverageColor 2-49 SI_ColorHistogram 2-49 SI_PositionalColor 2-49 SI_Texture 2-49 SI_FeatureList . 2-49 Expression Filter Type . 2-50 Expression 2-50 Datatype Comparison Rules 2-50 Numeric Values . 2-50 vi Date Values . 2-51 Character String Values 2-51 Single Characters . 2-52 Object Values 2-54 Varrays and Nested Tables . 2-54 Data Conversion 2-54 Implicit and Explicit Data Conversion 2-55 Implicit Data Conversion 2-55 Implicit Data Conversion Examples . 2-57 Explicit Data Conversion . 2-58 Literals 2-60 Text Literals 2-61 Numeric Literals 2-62 Integer Literals 2-63 NUMBER and Floating-Point Literals 2-63 Interval Literals . 2-65 INTERVAL YEAR TO MONTH 2-66 INTERVAL DAY TO SECOND . 2-67 Format Models 2-70 Number Format Models . 2-71 Number Format Elements . 2-71 Datetime Format Models 2-75 Datetime Format Elements 2-76 Uppercase Letters in Date Format Elements . 2-76 Punctuation and Character Literals in Datetime Format Models 2-76 Datetime Format Elements and Globalization Support 2-81 ISO Standard Date Format Elements . 2-81 The RR Datetime Format Element . 2-81 RR Datetime Format Examples 2-82 Datetime Format Element Suffixes 2-83 Format Model Modifiers . 2-83 Format Model Examples . 2-84 String-to-Date Conversion Rules . 2-87 XML Format Model . 2-88 Nulls . 2-89 vii Nulls in SQL Functions . 2-90 Nulls with Comparison Conditions 2-90 Nulls in Conditions . 2-90 Comments 2-91 Comments Within SQL Statements 2-91 Comments on Schema Objects . 2-93 Hints 2-93 Database Objects 2-105 Schema Objects 2-106 Nonschema Objects . 2-106 Schema Object Names and Qualifiers . 2-107 Schema Object Naming Rules 2-107 Schema Object Naming Examples 2-111 Schema Object Naming Guidelines 2-111 Syntax for Schema Objects and Parts in SQL Statements 2-112 How Oracle Database Resolves Schema Object References 2-113 Referring to Objects in Other Schemas . 2-114 Referring to Objects in Remote Databases . 2-114 Creating Database Links . 2-115 Database Link Names 2-115 Username and Password 2-116 Database Connect String . 2-116 Referring to Database Links 2-116 Referring to Partitioned Tables and Indexes . 2-117 Referring to Object Type Attributes and Methods 2-119 3 Pseudocolumns Hierarchical Query Pseudocolumns 3-1 CONNECT_BY_ISCYCLE 3-2 CONNECT_BY_ISLEAF . 3-2 LEVEL . 3-3 Sequence Pseudocolumns 3-4 Where to Use Sequence Values . 3-4 How to Use Sequence Values 3-5 Version Query Pseudocolumns . 3-7 viii OBJECT_ID . 3-7 OBJECT_VALUE 3-8 ORA_ROWSCN . 3-8 ROWID 3-9 ROWNUM . 3-10 XMLDATA . 3-11 4 Operators About SQL Operators . 4-1 Unary and Binary Operators 4-2 Operator Precedence . 4-2 Arithmetic Operators . 4-3 Concatenation Operator . 4-4 Hierarchical Query Operators 4-6 PRIOR 4-6 CONNECT_BY_ROOT . 4-6 Set Operators . 4-6 Multiset Operators . 4-7 MULTISET EXCEPT 4-8 MULTISET INTERSECT . 4-9 MULTISET UNION . 4-10 User-Defined Operators 4-11 5 Expressions About SQL Expressions 5-2 Simple Expressions 5-3 Compound Expressions 5-5 CASE Expressions 5-5 CURSOR Expressions 5-8 Datetime Expressions 5-10 Function Expressions . 5-12 Interval Expressions 5-12 Object Access Expressions . 5-13 Scalar Subquery Expressions . 5-14 Model Expressions 5-15 ix Type Constructor Expressions . 5-16 Variable Expressions . 5-18 Expression Lists 5-19 6 Conditions About SQL Conditions 6-2 Condition Precedence 6-4 Comparison Conditions . 6-4 Simple Comparison Conditions 6-6 Group Comparison Conditions . 6-8 Floating-Point Conditions 6-9 Logical Conditions 6-10 Range Conditions 6-11 Null Conditions . 6-12 Compound Conditions . 6-12 EQUALS_PATH 6-13 EXISTS . 6-14 IN . 6-14 IS A SET . 6-17 IS ANY . 6-18 IS EMPTY 6-19 IS OF type 6-20 IS PRESENT 6-21 LIKE 6-22 MEMBER . 6-26 REGEXP_LIKE 6-27 SUBMULTISET 6-29 UNDER_PATH . 6-30 7 Functions SQL Functions 7-1 Single-Row Functions . 7-3 Numeric Functions . 7-3 Character Functions Returning Character Values . 7-4 Character Functions Returning Number Values . 7-5 x Datetime Functions 7-5 Conversion Functions 7-6 Collection Functions 7-7 Miscellaneous Single-Row Functions 7-7 Aggregate Functions . 7-9 Analytic Functions . 7-11 Object Reference Functions 7-17 Model Functions 7-18 Alphabetical Listing of SQL Functions 7-18 ABS . 7-18 ACOS 7-19 ADD_MONTHS . 7-20 ASCII 7-21 ASCIISTR 7-21 ASIN . 7-22 ATAN 7-23 ATAN2 7-24 AVG 7-25 BFILENAME . 7-26 BIN_TO_NUM 7-27 BITAND . 7-28 CARDINALITY 7-30 CAST 7-30 CEIL 7-34 CHARTOROWID 7-34 CHR 7-35 COALESCE 7-37 COLLECT 7-39 COMPOSE . 7-39 CONCAT 7-40 CONVERT . 7-41 CORR 7-43 CORR_* 7-45 CORR_S . 7-46 CORR_K 7-47 [...]... blocks of an Oracle Database and of Oracle SQL Chapter 3, "Pseudocolumns" This chapter describes Oracle SQL pseudocolumns Chapter 4, "Operators" This chapter describes Oracle SQL operators Chapter 5, "Expressions" This chapter describes Oracle SQL expressions Chapter 6, "Conditions" This chapter describes Oracle SQL conditions Chapter 7, "Functions" This chapter describes how to use built-in Oracle SQL... descriptions of Oracle embedded SQL Many of the examples in this book use the sample schemas of the seed database, which is installed by default when you install Oracle Database Refer to Oracle Database Sample Schemas for information on how these schemas were created and how you can use them yourself Printed documentation is available for sale in the Oracle Store at http://oraclestore .oracle. com/ To... Appendix D, "Oracle Database Reserved Words" This appendix lists words that are reserved for internal use by Oracle Database Appendix E, "Examples" This appendix provides extended examples that use multiple SQL statements and are therefore not appropriate for any single section of the reference Structural Changes in the SQL Reference in Oracle Database 10g Release 1 The section on pseudocolumns, formerly... Documentation s Conventions s Documentation Accessibility Audience The Oracle Database SQL Reference is intended for all users of Oracle SQL Organization This reference is divided into the following parts: Chapter 1, "Introduction to Oracle SQL" This chapter discusses the history of SQL and describes the advantages of using it to access relational databases xxv Chapter 2, "Basic Elements of Oracle SQL" This chapter... list and describe all Oracle SQL statements in alphabetical order Appendix A, "How to Read Syntax Diagrams" This appendix describes how to read the syntax diagrams in this reference Appendix B, "Oracle and Standard SQL" This appendix describes Oracle Database compliance with ANSI and ISO standards xxvi Appendix C, "Oracle Regular Expression Support" This appendix describes Oracle Database compliance... Examples in Documentation Accessibility of Links to External Web Sites in Documentation This documentation may contain links to Web sites of other companies or organizations that Oracle does not own or control Oracle neither evaluates nor makes any representations regarding the accessibility of these Web sites xxxi xxxii What's New in the SQL Reference? This section describes new features of Oracle Database. .. Database Objects A-1 A-3 A-4 A-4 A-5 A-5 xxi B Oracle and Standard SQL ANSI Standards B-2 ISO Standards B-3 Oracle Compliance To Core SQL:2003 B-4 Oracle Support for Optional Features of SQL/Foundation:2003 B-11 Oracle Compliance with SQL/CLI:2003 B-17 Oracle Compliance with SQL/PSM:2003 B-17 Oracle Compliance... please indicate the title and part number of the documentation and the chapter, section, and page number (if available) You can send comments to us in the following ways: s s s Electronic mail: infodev_us @oracle. com FAX: (650) 506-7227 Attn: Server Technologies Documentation Manager Postal service: Oracle Corporation Oracle Server Technologies Documentation 500 Oracle Parkway, Mailstop 4op11 Redwood Shores,... 3, "Pseudocolumns" The section CREATE TEMPORARY TABLESPACE has been combined with the section CREATE TABLESPACE on page 16-80, because temporary tablespaces are a form of tablespace Related Documentation For more information, see these Oracle resources: s s PL/SQL User's Guide and Reference for information on PL/SQL, the procedural language extension to Oracle SQL Pro*C/C++ Programmer's Guide, Oracle. .. SQL/MED:2003 B-17 Oracle Compliance with SQL/XML:2003 B-17 Oracle Compliance with FIPS 127-2 B-19 Oracle Extensions to Standard SQL B-21 Character Set Support B-21 C Oracle Regular Expression Support Multilingual Regular Expression Syntax C-1 Regular Expression Operator Multilingual Enhancements C-4 D Oracle Database Reserved Words . Oracle Database SQL Reference 10g Release 1 (10.1) Part No. B10759-01 December 2003 Oracle Database SQL Reference 10g Release 1. and Oracle Corporation disclaims liability for any damages caused by such use of the Programs. Oracle is a registered trademark, and Oracle7 , Oracle8 , Oracle8 i,

Ngày đăng: 21/12/2013, 04:17

TỪ KHÓA LIÊN QUAN

w