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

oracle 8 sql reference

792 581 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 792
Dung lượng 2,98 MB

Nội dung

Oracle8™ SQL Reference Release 8.0 December 1997 Part No. A58225-01 Oracle8™ Server SQL Reference Part No. A58225-01 Release 8.0 Copyright © 1997 Oracle Corporation. All Rights Reserved. Primary Author: Diana Lorentz Contributors: Steve Bobrowski, Robert Jenkins, Susan Kotsovolos, Andre Kruglikov, Vishu Krishna, Muralidhar Krishnaprasa, Michael Kung, Paul Lane, Nina Lewis, Lefty Leverenz, Phil Locke, William Maimone, Mohammad Monajjemi, Rita Moran, Thomas Portfolio, Valarie Moore, Denis Raphaely, Rich- ard Sarwal, Rick Wong The programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inher- ently dangerous applications. It shall be licensee's responsibility to take all appropriate fail-safe, back up, redundancy and other measures to ensure the safe use of such applications if the Programs are used for such purposes, and Oracle disclaims liability for any damages caused by such use of the Pro- grams. This Program 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 patent and other intellectual property law. Reverse engineering of the software 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. If this Program is delivered to a U.S. Government Agency of the Department of Defense, then it is deliv- ered with Restricted Rights and the following legend is applicable: Restricted Rights Legend Programs delivered subject to the DOD FAR Supplement are 'commercial computer software' and use, duplication and disclosure of the Programs 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 disclo- sure of the Programs shall be subject to the restrictions in FAR 52 227-14, Rights in Data General, including Alternate III (June 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065. Oracle Call Interface, Oracle7, Oracle7 Server, Oracle8, Oracle Forms, Oracle Parallel Server, Net8, PL/ SQL, SQL*Net, Pro*C/C++, and SQL*Module are trademarks of Oracle Corporation, Redwood Shores, California. All other products or company names are used for identification purposes only, and may be trademarks of their respective owners. iii Contents Send Us Your Comments xv Preface xvii 1 Introduction History of SQL 1- 1 SQL Standards 1- 2 Embedded SQL 1- 3 Lexical Conventions 1- 4 Tools Support 1- 5 2 Elements of Oracle8 SQL Literals 2-2 Text 2-2 Integer 2-3 Number 2-4 Datatypes 2-5 Nulls 2-31 Pseudocolumns 2-32 Comments 2-38 Database Objects 2-44 Schema Object Names and Qualifiers 2-47 Referring to Schema Objects and Parts 2-51 iv 3 Operators, Functions, Expressions, Conditions Operators 3-1 SQL Functions 3-16 User Functions 3-60 Format Models 3-63 Expressions 3-78 Conditions 3-90 4 Commands Summary of SQL Commands 4 - 2 Data Definition Language (DDL) Commands 4 - 2 Data Manipulation Language (DML) Commands 4 - 7 Transaction Control Commands 4 - 8 Session Control Commands 4 - 8 System Control Command 4 - 9 Embedded SQL Commands 4 - 10 ALTER CLUSTER 4 - 11 Altering Clusters 4 - 13 ALTER DATABASE 4 - 15 Examples 4 - 23 ALTER FUNCTION 4 - 26 Recompiling Standalone Functions 4 - 26 ALTER INDEX 4 - 28 Examples 4 - 35 ALTER PACKAGE 4 - 38 Recompiling Stored Packages 4 - 38 ALTER PROCEDURE 4 - 41 Recompiling Stored Procedures 4 - 41 ALTER PROFILE 4 - 43 Using Password History 4 - 45 Examples 4 - 45 ALTER RESOURCE COST 4 - 48 Altering Resource Costs 4 - 48 ALTER ROLE 4 - 51 Changing Authorizations 4 - 51 v ALTER ROLLBACK SEGMENT 4 - 53 Altering Rollback Segments 4 - 54 ALTER SEQUENCE 4 - 56 Examples 4 - 57 ALTER SESSION 4 - 58 Enabling and Disabling the SQL Trace Facility 4 - 67 Using NLS Parameters 4 - 67 Changing the Optimization Approach and Mode 4 - 71 FIPS Flagging 4 - 71 Caching Session Cursors 4 - 71 Accessing the Database as if Connected to Another Instance in a Parallel Server 4 - 72 Closing Database Links 4 - 72 Forcing In-Doubt Distributed Transactions 4 - 73 Transaction Control in Procedures and Stored Functions 4 - 74 Parallel DML 4 - 74 ALTER SNAPSHOT 4 - 76 Examples 4 - 81 Specifying Rollback Segments 4 - 82 Primary Key Snapshots 4 - 82 Partitioned Snapshots 4 - 83 ALTER SNAPSHOT LOG 4 - 84 Modifying Physical Attributes 4 - 86 Adding Primary Key, ROWID, and Filter Columns 4 - 87 Partitioned Snapshot Logs 4 - 87 ALTER SYSTEM 4 - 88 Restricting Logons 4 - 97 Clearing the Shared Pool 4 - 97 Performing a Checkpoint 4 - 97 Checking Datafiles 4 - 98 Using Resource Limits 4 - 98 Global Name Resolution 4 - 99 Managing Processes for the Multithreaded Server 4 - 99 Using Licensing Limits 4 - 101 Switching Redo Log File Groups 4 - 102 Enabling and Disabling Distributed Recovery 4 - 103 vi Terminating a Session 4 - 103 Disconnecting a Session 4 - 104 ALTER TABLE 4 - 106 Adding Columns 4 - 122 Modifying Column Definitions 4 - 123 Index-Organized Tables 4 - 125 LOB Columns 4 - 125 Nested Table Columns 4 - 126 REFs 4 - 127 Modifying Table Partitions 4 - 128 ALTER TABLESPACE 4 - 133 Using ALTER TABLESPACE 4 - 138 ALTER TRIGGER 4 - 141 Invalid Triggers 4 - 141 Enabling and Disabling Triggers 4 - 142 ALTER TYPE 4 - 144 Restriction 4 - 147 ALTER USER 4 - 150 Establishing Default Roles 4 - 152 Changing Authentication Methods 4 - 152 ALTER VIEW 4 - 154 Recompiling Views 4 - 154 ANALYZE 4 - 156 Restrictions 4 - 160 Collecting Statistics 4 - 160 Clusters 4 - 163 Deleting Statistics 4 - 163 Validating Structures 4 - 164 Listing Chained Rows 4 - 166 ARCHIVE LOG clause 4 - 167 Restrictions 4 - 169 AUDIT (SQL Statements) 4 - 170 Auditing 4 - 171 Statement Options for Database Objects 4 - 172 Statement Options for Commands 4 - 174 vii Shortcuts for System Privileges and Statement Options 4 - 176 AUDIT (Schema Objects) 4 - 178 Object Options 4 - 179 Default Auditing 4 - 180 COMMENT 4 - 183 Using Comments 4 - 183 COMMIT 4 - 185 About Transactions 4 - 186 Ending Transactions 4 - 187 CONSTRAINT clause 4 - 188 Defining Integrity Constraints 4 - 192 NOT NULL Constraints 4 - 193 UNIQUE Constraints 4 - 193 PRIMARY KEY Constraints 4 - 195 Referential Integrity Constraints 4 - 196 CHECK Constraints 4 - 201 DEFERRABLE Constraints 4 - 204 Enabling and Disabling Constraints 4 - 205 CREATE CLUSTER 4 - 207 About Clusters 4 - 210 Cluster Keys 4 - 210 Types of Clusters 4 - 211 Cluster Size 4 - 212 Adding Tables to a Cluster 4 - 213 CREATE CONTROLFILE 4 - 215 Re-creating Control Files 4 - 218 CREATE DATABASE 4 - 219 Examples 4 - 223 CREATE DATABASE LINK 4 - 225 Creating Database Links 4 - 226 Current-User Database Links 4 - 227 Examples 4 - 228 CREATE DIRECTORY 4 - 230 Directory Objects 4 - 231 CREATE FUNCTION 4 - 232 viii Examples 4 - 235 CREATE INDEX 4 - 237 Creating Indexes 4 - 243 Index Columns 4 - 243 Multiple Indexes Per Table 4 - 244 The NOSORT Option 4 - 244 NOLOGGING 4 - 245 Nulls 4 - 245 Creating Cluster Indexes 4 - 245 Creating Partitioned Indexes 4 - 246 Creating Bitmap Indexes 4 - 246 Creating Indexes on Nested Table Columns 4 - 247 CREATE LIBRARY 4 - 248 Examples 4 - 249 CREATE PACKAGE 4 - 250 Packages 4 - 251 CREATE PACKAGE BODY 4 - 254 Examples 4 - 255 CREATE PROCEDURE 4 - 259 Using Procedures 4 - 262 CREATE PROFILE 4 - 265 Using Profiles 4 - 268 Fractions in Dates 4 - 269 The DEFAULT Profile 4 - 269 CREATE ROLE 4 - 272 Using Roles 4 - 273 Roles Predefined by Oracle 4 - 273 CREATE ROLLBACK SEGMENT 4 - 275 Rollback Segments and Tablespaces 4 - 276 CREATE SCHEMA 4 - 278 Creating Schemas 4 - 278 CREATE SEQUENCE 4 - 281 Using Sequences 4 - 283 Sequence Defaults 4 - 284 Incrementing Sequence Values 4 - 284 ix Caching Sequence Numbers 4 - 284 Accessing Sequence Values 4 - 285 CREATE SNAPSHOT 4 - 286 About Snapshots 4 - 291 Types of Snapshots 4 - 291 Refreshing Snapshots 4 - 292 Specifying Rollback Segments 4 - 294 Specifying Primary-Key or ROWID Snapshots 4 - 295 Partitioned Snapshots 4 - 296 CREATE SNAPSHOT LOG 4 - 297 Using Snapshot Logs 4 - 299 Recording Primary Keys, ROWIDs, and Filter Columns 4 - 300 CREATE SYNONYM 4 - 302 Using Synonyms 4 - 303 Scope of Synonyms 4 - 304 CREATE TABLE 4 - 306 Examples 4 - 321 LOB Column Example 4 - 322 Index-Organized Tables 4 - 323 Partitioned Tables 4 - 323 Object Tables 4 - 324 Nested Table Storage 4 - 325 REFs 4 - 325 CREATE TABLESPACE 4 - 328 About Tablespaces 4 - 330 CREATE TRIGGER 4 - 333 Using Triggers 4 - 336 Conditional Predicates 4 - 337 Parts of a Trigger 4 - 338 Types of Triggers 4 - 339 Snapshot Log Triggers 4 - 340 INSTEAD OF Triggers 4 - 342 User-Defined Types, LOB, and REF Columns 4 - 343 CREATE TYPE 4 - 345 Incomplete Object Types 4 - 351 x Constructors 4 - 352 CREATE TYPE BODY 4 - 353 TYPE and TYPE BODY 4 - 355 CREATE USER 4 - 357 Verifying Users Through Your Operating System 4 - 359 Verifying Users Through the Network 4 - 360 Establishing Tablespace Quotas for Users 4 - 360 Granting Privileges to a User 4 - 360 CREATE VIEW 4 - 363 Using Views 4 - 366 The View Query 4 - 366 Join Views 4 - 368 Partition Views 4 - 369 Examples 4 - 370 Object Views 4 - 370 DEALLOCATE UNUSED clause 4 - 372 Deallocating Unused Space 4 - 372 DELETE 4 - 374 Using DELETE 4 - 377 Deleting from a Single Partition 4 - 378 The RETURNING Clause 4 - 378 DISABLE clause 4 - 380 Using the DISABLE Clause 4 - 381 DROP clause 4 - 384 Removing Integrity Constraints 4 - 384 DROP CLUSTER 4 - 386 Restrictions 4 - 386 DROP DATABASE LINK 4 - 388 Restrictions 4 - 388 Example 4 - 388 DROP DIRECTORY 4 - 389 Dropping a Directory 4 - 389 DROP FUNCTION 4 - 390 Dropping Functions 4 - 390 DROP INDEX 4 - 392 [...]... 7654 76 98 7 782 7 788 783 9 784 4 787 6 7900 7902 7934 ENAME SMITH ALLEN WARD JONES MARTIN BLAKE CLARK SCOTT KING TURNER ADAMS JAMES FORD MILLER JOB MGR HIREDATE SAL COMM DEPTNO - - CLERK 7902 17-DEC -80 80 0 20 SALESMAN 76 98 20-FEB -81 1600 300 30 SALESMAN 76 98 22-FEB -81 1250 500 30 MANAGER 783 9 02-APR -81 2975 20 SALESMAN 76 98 28- SEP -81 1250 1400 30 MANAGER 783 9 01-MAY -81 285 0 30... 02-APR -81 2975 20 SALESMAN 76 98 28- SEP -81 1250 1400 30 MANAGER 783 9 01-MAY -81 285 0 30 MANAGER 783 9 09-JUN -81 2450 10 ANALYST 7566 19-APR -87 3000 20 PRESIDENT 17-NOV -81 5000 10 SALESMAN 76 98 08- SEP -81 1500 30 CLERK 7 788 23-MAY -87 1100 20 CLERK 76 98 03-DEC -81 950 30 ANALYST 7566 03-DEC -81 3000 20 CLERK 7 782 23-JAN -82 1300 10 SELECT * FROM salgrade GRADE 1 2 3 4 5 LOSAL 700 1201 1401 2001 3001 HISAL ... comments to Server Technologies Documentation Manager Oracle Corporation 500 Oracle Parkway Redwood Shores, CA 94065 or e-mail comments to: infodev@us .oracle. com Part No A 582 25-01 -xv -xvi Oracle8 SQL Reference Preface This reference contains a complete description of the Structured Query Language (SQL) used to manage information in an Oracle database Oracle SQL is a superset of the American National Standards... (ISO) SQL9 2 standard at entry level conformance For information on PL /SQL, Oracle s procedural language extension to SQL, see PL /SQL User’s Guide and Reference Detailed descriptions of Oracle embedded SQL can be found in the Pro*C/C++ Precompiler Programmer’s Guide, SQL* Module for Ada Programmer’s Guide, and the Pro*COBOL Precompiler Programmer’s Guide Features and Functionality Oracle8 SQL Reference. .. discussion of the restrictions in the manual describing the tool, such as PL /SQL User’s Guide and Reference Introduction 1-5 Tools Support 1-6 Oracle8 SQL Reference 2 Elements of Oracle8 SQL This chapter contains reference information on the basic elements of Oracle SQL Note: Commands and descriptions preceded by are available only if the Oracle objects option is installed on your database server Before using... CONSTRAINT(S) Examples 4 - 466 4 - 467 4 - 467 4 - 469 4 - 471 4 - 473 4 - 473 4 - 473 4 - 475 4 - 475 4 - 476 4 - 476 4 - 477 4 - 4 78 4 - 480 4 - 480 4 - 480 4 - 481 4 - 481 4 - 484 4 - 484 4 - 486 4 - 487 4 - 487 4 - 489 4 - 493 4 - 495 4 - 499 4 - 500 4 - 501 4 - 501 4 - 503 4 - 505 4 - 514 4 - 514 xiii SET ROLE Privilege Domains Examples ... A Syntax Diagrams B Oracle and Standard SQL C Oracle Reserved Words and Keywords xiv 4 - 516 4 - 517 4 - 5 18 4 - 519 4 - 520 4 - 521 4 - 523 4 - 526 4 - 527 4 - 527 4 - 530 4 - 532 4 - 533 4 - 534 4 - 535 4 - 536 4 - 536 4 - 5 38 4 - 539 4 - 540 4 - 540 4 - 542 4 - 545 4 - 546 4 - 547 4 - 549 Send Us Your Comments Oracle8 SQL Reference, Release 8. 0 Part No A 582 25-01 Oracle Corporation welcomes... differences between Oracle8 and the Oracle8 Enterprise Edition and the features and options that are available to you, see Getting to Know Oracle8 and the Oracle8 Enterprise Edition Audience This reference is intended for all users of Oracle SQL xvii How this Reference Is Organized This reference is divided into the following parts: Chapter 1: Introduction This chapter defines SQL and describes its history... The latest SQL standard published by ANSI and ISO is often called SQL9 2 (and sometimes SQL2 ) The formal names of the new standard are: s ANSI X3.135-1992, “Database Language SQL s ISO/IEC 9075:1992, “Database Language SQL SQL9 2 defines four levels of compliance: Entry, Transitional, Intermediate, and Full A conforming SQL implementation must support at least Entry SQL Oracle8 , Release 8. 0, fully supports... of the Oracle8 and the Oracle8 Enterprise Edition products Oracle8 and Oracle8 Enterprise Edition have the same basic features However, several advanced features are available only with the Enterprise Edition, and some of these are optional For example, to use the CREATE TYPE command, you must have the Enterprise Edition and the Objects Option For information about the differences between Oracle8 and . Oracle8 ™ SQL Reference Release 8. 0 December 1997 Part No. A 582 25-01 Oracle8 ™ Server SQL Reference Part No. A 582 25-01 Release 8. 0 Copyright © 1997 Oracle Corporation. All. (June 1 987 ). Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065. Oracle Call Interface, Oracle7 , Oracle7 Server, Oracle8 , Oracle Forms, Oracle Parallel Server, Net8, PL/ SQL, SQL* Net,. Syntax Diagrams B Oracle and Standard SQL C Oracle Reserved Words and Keywords Part No. A 582 25-01 -xv Send Us Your Comments Oracle8 SQL Reference, Release 8. 0 Part No. A 582 25-01 Oracle Corporation

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

TỪ KHÓA LIÊN QUAN