oracle 9i sql reference

1.5K 1.2K 0
oracle 9i sql reference

Đ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

Oracle9 i SQL Reference Release 1 (9.0.1) June 2001 Part No. A90125-01 Oracle9i SQL Reference, Release 1 (9.0.1) Part No. A90125-01 Copyright © 1996, 2001, Oracle Corporation. All rights reserved. Primary Author: Diana Lorentz Contributors: Nipun Agarwal, David Alpern, Patrick Amor, Rick Anderson, Geeta Arora, Nimar Arora, Lance Ashdown, Cathy Baird, Sandeepan Banerjee, Cailein Barclay, Subrhansu Basu, Mark Bauer, Ruth Baylis, Harmeek Bedi, Barbara Benton, Paula Bingham, Steve Bobrowski, Tolga Bozkaya, Allen Brumm, Bridget Burke, Ted Burroughs, Greg Casbolt, Sivasankaran Chandrasekar, Thomas Chang, Eugene Chong, Greg Cook, Michele Cyran, Ravindra Dani, Dinesh Das, Mary Ann Davidson , Norbert Debes, Connie Dialeris, Alan Downing, Amit Ganesh, Bill Gietz, Govind Govindarajan, Ray Guzman, John Haydu, Shelley Higgins, Thuvan Hoang, Wei Hu, Jiansheng Huang, Alexander Hunold, Bob Jenkins, Mark Johnson, Nitin Karkhanis, Vishy Karra, Jonathan Klein, Susan Kotsovolos, Vishu Krishnamurthy, Ramkumar Krishnan, Muralidhar Krishnaprasad, Paul Lane, Simon Law, Shilpa Lawande, Seong Yong Albert Lee, Bill Lee, Yunrui Li, Li-Sen Liu, Shih-Hao Liu, Jing Liu, Phil Locke, Lenore Luscher, Kevin MacDowell, Steve McGee, Colin McGregor, Jack Melnick, Ben Meng, Magdi Morsi, Ari Mozes, Sreedhar Mukkamalla, Subramanian Muralidhar, Ravi Murthy, Sujatha Muthulingam, Gary Ngai, Ron Obermarck, Jeffrey Olkin, Kevin Osinski, Ananth Raghavan, Jack Raitto, Den Raphaely, Siva Ravada, John Russell, Vivian Schupmann, Ajay Sethi, Lei Sheng, Wayne Smith, Ekrem Soylemez, Jagannathan Srinivasan, Jim Stenoish, Mike Stewart, Seema Sundara, Ashish Thusoo, Rosanne Park Toohey, Anh-Tuan Tran, Kothanda Umamageswaran, Randy Urbano, Sandy Venning, Andre Vergison, Steve Vivian, Eric Voss, Rick Wessman, Daniel Wong, Aravind Yalamanchi, Adiel Yoaz, Qin Yu, Mohamed Zait, Fred Zemke, Mohamed Ziauddin, and many many others. 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 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 Oracle9i, Oracle Call Interface, Oracle Database Configuration Assistant, Oracle Enterprise Manager, Oracle interMedia, Oracle Net, Oracle Spatial, Oracle Store, Oracle Text, Oracle Trace, PL/SQL, Real Application Clusters, and SQL*Plus are trademarks or registered trademarks of Oracle Corporation. Other names may be trademarks of their respective owners. iii Contents Send Us Your Comments xv Preface xvii What’s New in the SQL Reference? xxvii 1 Introduction 2 Basic Elements of Oracle SQL Datatypes 2-2 Literals 2-51 Format Models 2-59 Nulls 2-77 Pseudocolumns 2-79 Comments 2-85 Database Objects 2-102 Schema Object Names and Qualifiers 2-106 Syntax for Schema Objects and Parts in SQL Statements 2-111 3 Operators About SQL Operators 3-2 Arithmetic Operators 3-3 Concatenation Operator 3-4 Set Operators 3-6 iv User-Defined Operators 3-6 4 Expressions About SQL Expressions 4-2 Simple Expressions 4-3 Compound Expressions 4-4 CASE Expressions 4-5 CURSOR Expressions 4-7 Datetime Expressions 4-9 Function Expressions 4-11 INTERVAL Expressions 4-11 Object Access Expressions 4-12 Scalar Subquery Expressions 4-13 Type Constructor Expressions 4-13 Variable Expressions 4-15 Expression List 4-15 5 Conditions About SQL Conditions 5-2 Comparison Conditions 5-4 Logical Conditions 5-7 Membership Conditions 5-9 Range Conditions 5-11 Null Conditions 5-11 EXISTS Conditions 5-11 LIKE Conditions 5-12 IS OF type Conditions 5-16 Compound Conditions 5-17 6 Functions SQL Functions 6-2 ABS 6-15 ACOS 6-15 ADD_MONTHS 6-16 v ASCII 6-16 ASCIISTR 6-17 ASIN 6-18 ATAN 6-19 ATAN2 6-19 AV G 6-20 BFILENAME 6-21 BIN_TO_NUM 6-22 BITAND 6-23 CAST 6-24 CEIL 6-27 CHARTOROWID 6-27 CHR 6-28 COALESCE 6-29 COMPOSE 6-31 CONCAT 6-31 CONVERT 6-32 CORR 6-34 COS 6-36 COSH 6-36 COUNT 6-37 COVAR_POP 6-39 COVAR_SAMP 6-41 CUME_DIST 6-43 CURRENT_DATE 6-45 CURRENT_TIMESTAMP 6-46 DBTIMEZONE 6-47 DECODE 6-47 DECOMPOSE 6-49 DENSE_RANK 6-50 DEREF 6-52 DUMP 6-53 EMPTY_BLOB, EMPTY_CLOB 6-55 EXISTSNODE 6-55 EXP 6-56 vi EXTRACT (datetime) 6-57 EXTRACT (XML) 6-58 FIRST 6-59 FIRST_VALUE 6-61 FLOOR 6-63 FROM_TZ 6-63 GREATEST 6-64 GROUP_ID 6-65 GROUPING 6-66 GROUPING_ID 6-67 HEXTORAW 6-69 INITCAP 6-69 INSTR 6-70 LAG 6-72 LAST 6-73 LAST_DAY 6-75 LAST_VALUE 6-76 LEAD 6-78 LEAST 6-80 LENGTH 6-80 LN 6-81 LOCALTIMESTAMP 6-82 LOG 6-83 LOWER 6-83 LPAD 6-84 LTRIM 6-85 MAKE_REF 6-85 MAX 6-86 MIN 6-89 MOD 6-90 MONTHS_BETWEEN 6-91 NCHR 6-92 NEW_TIME 6-93 NEXT_DAY 6-94 NLS_CHARSET_DECL_LEN 6-94 vii NLS_CHARSET_ID 6-95 NLS_CHARSET_NAME 6-96 NLS_INITCAP 6-96 NLS_LOWER 6-98 NLSSORT 6-99 NLS_UPPER 6-100 NTILE 6-101 NULLIF 6-102 NUMTODSINTERVAL 6-103 NUMTOYMINTERVAL 6-104 NVL 6-105 NVL2 6-106 PERCENT_RANK 6-107 PERCENTILE_CONT 6-109 PERCENTILE_DISC 6-112 POWER 6-113 RANK 6-114 RATIO_TO_REPORT 6-116 RAWTOHEX 6-117 RAWTONHEX 6-118 REF 6-118 REFTOHEX 6-119 REGR_ (linear regression) functions 6-120 REPLACE 6-128 ROUND (number) 6-129 ROUND (date) 6-130 ROW_NUMBER 6-131 ROWIDTOCHAR 6-132 ROWIDTONCHAR 6-133 RPAD 6-133 RTRIM 6-134 SESSIONTIMEZONE 6-135 SIGN 6-135 SIN 6-136 SINH 6-136 viii SOUNDEX 6-137 SQRT 6-138 STDDEV 6-139 STDDEV_POP 6-140 STDDEV_SAMP 6-142 SUBSTR 6-144 SUM 6-145 SYS_CONNECT_BY_PATH 6-147 SYS_CONTEXT 6-148 SYS_DBURIGEN 6-153 SYS_EXTRACT_UTC 6-154 SYS_GUID 6-155 SYS_TYPEID 6-156 SYS_XMLAGG 6-157 SYS_XMLGEN 6-158 SYSDATE 6-159 SYSTIMESTAMP 6-160 TAN 6-161 TANH 6-161 TO_CHAR (character) 6-162 TO_CHAR (datetime) 6-163 TO_CHAR (number) 6-165 TO_CLOB 6-167 TO_DATE 6-167 TO_DSINTERVAL 6-168 TO_LOB 6-169 TO_MULTI_BYTE 6-170 TO_NCHAR (character) 6-171 TO_NCHAR (datetime) 6-172 TO_NCHAR (number) 6-173 TO_NCLOB 6-174 TO_NUMBER 6-174 TO_SINGLE_BYTE 6-175 TO_TIMESTAMP 6-176 TO_TIMESTAMP_TZ 6-177 ix TO_YMINTERVAL 6-178 TRANSLATE 6-179 TRANSLATE USING 6-180 TREAT 6-182 TRIM 6-183 TRUNC (number) 6-184 TRUNC (date) 6-185 TZ_OFFSET 6-186 UID 6-187 UNISTR 6-187 UPPER 6-188 USER 6-189 USERENV 6-189 VALUE 6-191 VAR_POP 6-192 VAR_SAMP 6-194 VARIANCE 6-195 VSIZE 6-197 WIDTH_BUCKET 6-198 ROUND and TRUNC Date Functions 6-199 User-Defined Functions 6-201 7 SQL Queries and Other SQL Statements Queries and Subqueries 7-2 Types of SQL Statements 7-16 8 SQL Statements: ALTER CLUSTER to ALTER SEQUENCE ALTER CLUSTER 8-3 ALTER DATABASE 8-9 ALTER DIMENSION 8-44 ALTER FUNCTION 8-48 ALTER INDEX 8-51 ALTER INDEXTYPE 8-72 ALTER JAVA 8-74 x ALTER MATERIALIZED VIEW 8-77 ALTER MATERIALIZED VIEW LOG 8-93 ALTER OUTLINE 8-100 ALTER PACKAGE 8-102 ALTER PROCEDURE 8-106 ALTER PROFILE 8-109 ALTER RESOURCE COST 8-113 ALTER ROLE 8-116 ALTER ROLLBACK SEGMENT 8-118 ALTER SEQUENCE 8-122 9 SQL Statements: ALTER SESSION to ALTER SYSTEM ALTER SESSION 9-2 Initialization Parameters and ALTER SESSION 9-7 Session Parameters and ALTER SESSION 9-11 ALTER SYSTEM 9-20 Initialization Parameters and ALTER SYSTEM 9-33 10 SQL Statements: ALTER TABLE to ALTER TABLESPACE ALTER TABLE 10-2 ALTER TABLESPACE 10-82 11 SQL Statements: ALTER TRIGGER to constraint_clause ALTER TRIGGER 11-2 ALTER TYPE 11-6 ALTER USER 11-20 ALTER VIEW 11-28 ANALYZE 11-31 ASSOCIATE STATISTICS 11-46 AUDIT 11-50 CALL 11-64 [...]... the SQL Reference? This section describes new features of Oracle9 i Release 1 (9.0.1) and provides pointers to additional information Oracle8 i new features information is also retained to help those users migrating from Oracle7 to Oracle9 i Release 1 (9.0.1) The following sections describe the new features in the Oracle9 i SQL Reference: s Oracle9 i Release 1 (9.0.1) New Features in SQL Reference s Oracle8 i... The SQL Reference is intended for all users of Oracle SQL Organization This reference is divided into the following parts: Volume 1 Chapter 1, "Introduction" This chapter discusses the history of SQL and describes the advantages of using it to access relational databases Chapter 2, "Basic Elements of Oracle SQL" This chapter describes the basic building blocks of an Oracle database and of Oracle SQL. .. page 11-50 The two SQL statements NOAUDIT sql_ statements and NOAUDIT schema_ objects have been combined into one NOAUDIT statement See NOAUDIT on page 16-79 Related Documentation For more information, see these Oracle resources: s s PL /SQL User’s Guide and Reference for information on PL /SQL, Oracle s procedural language extension to SQL Pro*C/C++ Precompiler Programmer’s Guide, SQL* Module for Ada... describes SQL operators Chapter 4, "Expressions" This chapter describes SQL expressions Chapter 5, "Conditions" This chapter describes SQL conditions Chapter 6, "Functions" This chapter describes how to use SQL functions Chapter 7, "SQL Queries and Other SQL Statements" This chapter describes the different types of SQL queries and lists the various types of SQL statements xviii Volume 2 Chapter 8, "SQL Statements:... (9.0.1) New Features in SQL Reference s Oracle8 i New Features in SQL Reference xxvii Oracle9 i Release 1 (9.0.1) New Features in SQL Reference The following built-in datatypes are new or modified in this release: s s s s s Oracle provides SQL- based interfaces for defining new types when the built-in or ANSI-supported types are not sufficient See "Oracle- Supplied Types" on page 2-38 "CHAR Datatype" on page 2-10... 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 Refer to Oracle9 i Sample Schemas for information on how these schemas were created and how you can use them yourself xxi In North America, printed documentation is available for sale in the Oracle Store at http://oraclestore .oracle. com/... Appendix C, "Oracle Reserved Words" This appendix lists words that are reserved for internal use by Oracle Structural Changes in the SQL Reference in Oracle9 i Release 1 (9.0.1) The chapter that formerly described expressions, conditions, and queries has been divided Conditions and expressions are now two separate chapters, and queries are described in Chapter 7, "SQL Queries and Other SQL Statements"... ROLLBACK SEGMENT" Chapter 16, "SQL Statements: DROP SEQUENCE to ROLLBACK" Chapter 17, "SQL Statements: SAVEPOINT to UPDATE" These chapters 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 compliance with ANSI... s ANSI X3.135-1999, "Database Language SQL" , Parts 1 ("Framework"), 2 ("Foundation"), and 5 ("Bindings") ISO/IEC 9075:1999, "Database Language SQL" , Parts 1 ("Framework"), 2 ("Foundation"), and 5 ("Bindings") See Also: Appendix B, "Oracle and Standard SQL" for a detailed description of Oracle s conformance to the SQL: 99 standards How SQL Works The strengths of SQL provide benefits for all types of users,... administrators, managers, and end users Technically speaking, SQL is a data sublanguage The purpose of SQL is to provide an interface to a relational database such as Oracle, and all SQL statements are instructions to the database In this SQL differs from general-purpose programming languages like C and BASIC Among the features of SQL are the following: 1-2 SQL Reference . Configuration Assistant, Oracle Enterprise Manager, Oracle interMedia, Oracle Net, Oracle Spatial, Oracle Store, Oracle Text, Oracle Trace, PL /SQL, Real Application Clusters, and SQL* Plus are trademarks. Oracle9 i SQL Reference Release 1 (9.0.1) June 2001 Part No. A90125-01 Oracle9 i SQL Reference, Release 1 (9.0.1) Part No. A90125-01 Copyright © 1996, 2001, Oracle Corporation purposes, and Oracle Corporation disclaims liability for any damages caused by such use of the Programs. Oracle is a registered trademark, and Oracle9 i, Oracle Call Interface, Oracle Database

Ngày đăng: 07/04/2014, 15:50

Mục lục

  • Send Us Your Comments

  • What’s New in the SQL Reference?

  • 2 Basic Elements of Oracle SQL

    • Datatypes

      • Oracle Built-in Datatypes

      • ANSI, DB2, and SQL/DS Datatypes

      • Format Models

        • Number Format Models

        • Nulls

          • Nulls in SQL Functions

          • Nulls with Comparison Conditions

          • Comments

            • Comments Within SQL Statements

            • Comments on Schema Objects

            • Parts of Schema Objects

            • Schema Object Names and Qualifiers

              • Schema Object Naming Rules

              • Schema Object Naming Examples

              • Schema Object Naming Guidelines

              • Syntax for Schema Objects and Parts in SQL Statements

                • How Oracle Resolves Schema Object References

                • Referring to Objects in Other Schemas

                • Referring to Objects in Remote Databases

                • Referencing Object Type Attributes and Methods

                • 3 Operators

                  • About SQL Operators

                    • Unary and Binary Operators

                    • 5 Conditions

                      • About SQL Conditions

                        • Types of Conditions

                        • Comparison Conditions

                          • Simple Comparison Conditions

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

Tài liệu liên quan