Oracle Database 10g The Complete Reference phần 9 pptx

135 344 0
Oracle Database 10g The Complete Reference phần 9 pptx

Đ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

CONDITION A condition is an expression whose value evaluates to either TRUE or FALSE, such as Age > 65. CONNECT (Form 1—SQL*Plus)) SEE ALSO COMMIT, DISCONNECT, Chapter 23 FORMAT CON[NECT] [{ user [/ password ] [@ connect_identifier ] |/} [AS SYSOPER|SYSDBA}]]; DESCRIPTION You must be in SQL*Plus to use this command, although you don’t need to be logged onto Oracle ( see DISCONNECT). CONNECT commits any pending changes, logs you off of Oracle, and logs on as the specified user. If the password is absent, you are prompted for it. It is not displayed when you type it in response to a prompt. @connect_identifier connects to the named database. It may be on your host, or on another computer connected via Oracle Net. CONNECT (Form 2—Embedded SQL) SEE ALSO COMMIT, DECLARE DATABASE, Chapter 23 FORMAT EXEC SQL CONNECT { :user IDENTIFIED BY : password | : user_password } [AT { database | : host_variable }] [USING : connect_string ] [ALTER AUTHORIZATION : new_password | IN {SYSDBA | SYSOPER } MODE ] DESCRIPTION CONNECT connects a host program to a local or remote database. It may be used more than once to connect to multiple databases. : user_password is a host variable that contains the Oracle username and password separated by a slash (/). Alternatively, : user and : password can be entered separately by using the second format. AT is used to name a database other than the default for this user. It is a required clause to reach any databases other than the user’s default database. This name can be used later in other SQL statements with AT. This database must be first identified with DECLARE DATABASE. USING specifies an optional Oracle Net string (such as a service name) used during the CONNECT operation. Without the USING string, you will be connected to the user’s default database, regardless of the database named in the AT line. CONNECT BY SEE ALSO Chapter 14 FORMAT SELECT expression [, expression ] FROM [ user .] table WHERE condition CONNECT BY [PRIOR] expression = [PRIOR] expression START WITH expression = expression ORDER BY expression CONNECT BY 1063 ORACLE Series TIGHT / Oracle Database 10g: TCR / Loney / 225351-7 / Chapter 1 Blind Folio 1:1063 P:\010Comp\Oracle8\351-7\Part9A.vp Friday, August 13, 2004 3:14:12 PM Color profile: Generic CMYK printer profile Composite Default screen DESCRIPTION CONNECT BY is an operator used in a SELECT statement to create reports on inheritance in tree-structured data, such as company organization, family trees, and so on. START WITH tells where in the tree to begin. These are the rules: ■ The position of PRIOR with respect to the CONNECT BY expressions determines which expression identifies the root and which identifies the branches of the tree. ■ A WHERE clause will eliminate individuals from the tree, but not their descendants (or ancestors, depending on the location of PRIOR). ■ A qualification in the CONNECT BY (particularly a not equal sign instead of the equal sign) will eliminate both an individual and all of its descendants. ■ CONNECT BY cannot be used with a table join in the WHERE clause. EXAMPLE select Cow, Bull, LPAD(' ',6*(Level-1))||Offspring AS Offspring, Sex, Birthdate from BREEDING connect by Offspring = PRIOR Cow start with Offspring = 'DELLA' order by Birthdate; In this example, the following clause: connect by Offspring = PRIOR Cow means the offspring is the cow PRIOR to this one. CONSTRAINT A constraint is a rule or restriction concerning a piece of data (such as a NOT NULL restriction on a column) that is enforced at the data level rather than at the object or application level. See INTEGRITY CONSTRAINT. CONSTRAINTS SEE ALSO CREATE TABLE, INTEGRITY CONSTRAINT, Chapter 17 FORMAT constraint::= 1064 Part IX: Alphabetical Reference ORACLE Series TIGHT / Oracle Database 10g: TCR / Loney / 225351-7 / Chapter 1 Blind Folio 1:1064 inline_constraint out_of_line_constraint inline_ref_constraint out_of_line_ref_constraint P:\010Comp\Oracle8\351-7\Part9A.vp Friday, August 13, 2004 3:14:13 PM Color profile: Generic CMYK printer profile Composite Default screen inline_constraint::= out_of_line_constraint::= inline_ref_constraint::= out_of_line_ref_constraint CONSTRAINTS 1065 ORACLE Series TIGHT / Oracle Database 10g: TCR / Loney / 225351-7 / Chapter 1 Blind Folio 1:1065 CONSTRAINT constraint_name NOT NULL UNIQUE PRIMARY KEY references_clause CHECK ( condition ) constraint_state CONSTRAINT constraint_name UNIQUE ( column , ) PRIMARY KEY ( column , ) FOREIGN KEY ( column , ) references_clause CHECK ( condition ) constraint_state SCOPE IS schema . scope_table WITH ROWID CONSTRAINT constraint_name references_clause constraint_state SCOPE FOR ( ref_col ref_attr ) IS schema . scope_table REF ( ref_col ref_attr ) WITH ROWID CONSTRAINT constraint_name FOREIGN KEY ( ref_col ref_attr ) references_clause constraint_state P:\010Comp\Oracle8\351-7\CD\Ventura\Part9B.vp Friday, August 13, 2004 4:25:46 PM Color profile: Generic CMYK printer profile Composite Default screen references_clause::= constraint_state::= using_index_clause::= index_properties::= 1066 Part IX: Alphabetical Reference ORACLE Series TIGHT / Oracle Database 10g: TCR / Loney / 225351-7 / Chapter 1 Blind Folio 1:1066 NOT DEFERRABLE INITIALLY IMMEDIATE DEFERRED ENABLE DISABLE VALIDATE NOVALIDATE RELY NORELY using_index_clause exceptions_clause USING INDEX schema . index ( create_index_statement ) index_properties global_partitioned_index local_partitioned_index index_attributes domain_index_clause REFERENCES schema . object ( column ) ON DELETE CASCADE SET NULL P:\010Comp\Oracle8\351-7\CD\Ventura\Part9B.vp Friday, August 13, 2004 4:25:46 PM Color profile: Generic CMYK printer profile Composite Default screen index_attributes::= exceptions_clause::= DESCRIPTION Constraints are defined with the RELATIONAL_PROPERTIES clause of the CREATE TABLE and ALTER TABLE commands. You use the constraints clauses to create a constraint or to alter an existing constraint. You can enable and disable constraints. If you disable a constraint and then try to re-enable it, Oracle will check the data. If the constraint cannot be re-enabled, Oracle can write the exceptions out to a separate table for review. For PRIMARY KEY and UNIQUE constraints, Oracle creates indexes. As part of the constraint clause for those constraints, you can use the USING INDEX clause to specify the tablespace and storage for the index. CONTAINS CONTAINS is used to evaluate text searches that use CONTEXT indexes within Oracle Text. See Chapter 25. Supported text search operators for CONTAINS are shown in the following table: Operator Description OR Returns a record if either search term has a score that exceeds the threshold. | Same as OR. AND Returns a record if both search terms have a score that exceeds the threshold. & Same as AND. ACCUM Returns a record if the sum of the search terms’ scores exceeds the threshold. , Same as ACCUM. CONTAINS 1067 ORACLE Series TIGHT / Oracle Database 10g: TCR / Loney / 225351-7 / Chapter 1 Blind Folio 1:1067 EXCEPTIONS INTO schema . table physical_attributes_clause logging_clause ONLINE COMPUTE STATISTICS TABLESPACE tablespace DEFAULT key_compression SORT NOSORT REVERSE parallel_clause P:\010Comp\Oracle8\351-7\CD\Ventura\Part9B.vp Friday, August 13, 2004 4:25:47 PM Color profile: Generic CMYK printer profile Composite Default screen Operator Description MINUS Returns a record if the score of the first search minus the score of the second search exceeds the threshold. - Same as MINUS. * Assigns different weights to the score of the searches. NEAR The score will be based on how near the search terms are to each other in the searched text. ; Same as NEAR. {} Encloses reserved words such as AND if they are part of the search term. % Multiple-character wildcard. _ Single-character wildcard. $ Performs stem expansion of the search term prior to performing the search. ? Performs a fuzzy match (allowing for misspellings) of the search term prior to performing the search. ! Performs a SOUNDEX (phonetic) search. () Specifies the order in which search criteria are evaluated. CONTEXT AREA A context area is work area in memory where Oracle stores the current SQL statement and, if the statement is a query, one row of the result. The context area holds the state of a cursor. CONTEXT INDEX Oracle Text supports three types of text indexes: CONTEXT indexes, CTXCAT indexes, and CTXRULE indexes. CONTEXT indexes use the CONTAINS operator and support a wider array of text search capabilities. CTXCAT indexes support a narrower set of search operators but support the creation of index sets. CTXRULE indexes are indexes on columns that contain a set of text queries. See Chapter 25 for details. CONTROL FILE (DATABASE) A control file is a small administrative file that is required by every database to enable the database to start and run a database system. Multiple identical control files are created for redundancy. CONTROL FILE (SQL*LOADER) A SQL*Loader control file tells the SQL*Loader executable where to find the data to be loaded, and how to process the data during the load. Every SQL*Loader session has an associated control file. For control file syntax, see SQLLDR. For details on the use of SQL*Loader, see Chapter 21. CONVERSION FUNCTIONS SEE ALSO CHARACTER FUNCTIONS, NUMBER FUNCTIONS, AGGREGATE FUNCTIONS, Chapter 11 DESCRIPTION The following is an alphabetical list of all current conversion and transformation functions in Oracle version of SQL. 1068 Part IX: Alphabetical Reference ORACLE Series TIGHT / Oracle Database 10g: TCR / Loney / 225351-7 / Chapter 1 Blind Folio 1:1068 P:\010Comp\Oracle8\351-7\CD\Ventura\Part9B.vp Friday, August 13, 2004 4:25:47 PM Color profile: Generic CMYK printer profile Composite Default screen Function Name Definition ASCIISTR Translates a string in any character set and returns an ASCII string in the database character set. BIN_TO_NUM Converts a binary value to its numerical equivalent. CAST CASTs one built-in or collection type to another; commonly used with nested tables and varying arrays. CHARTOROWID Changes a character string to act like an internal Oracle row identifier, or ROWID. COMPOSE Translates a string in any datatype to a Unicode string in its fully normalized form in the same character set as the input. CONVERT CONVERTs a character string from one national language character set to another. DECOMPOSE Translates a string in any datatype to a Unicode string after canonical decomposition in the same character set as the input. HEXTORAW Changes a character string of hex numbers into binary. NUMTODSINTERVAL Converts a NUMBER to an INTERVAL DAY TO SECOND literal. NUMTOYMINTERVAL Converts a NUMBER to an INTERVAL YEAR TO MONTH literal. RAWTOHEX Changes a string of binary numbers to a character string of hex numbers. RAWTONHEX Converts RAW to an NVARCHAR2 character value containing its hexadecimal equivalent. ROWIDTOCHAR Changes an internal Oracle row identifier, or ROWID, to a character string. ROWIDTONCHAR Converts a ROWID value to an NVARCHAR2 datatype. SCN_TO_TIMESTAMP Converts a system change number to an approximate timestamp. TIMESTAMP_TO_SCN Converts a timestamp to an approximate system change number. TO_BINARY_DOUBLE Returns a double-precision floating-point number. TO_BINARY_FLOAT Returns a single-precision floating-point number. TO_CHAR Converts a NUMBER or DATE to a character string. TO_CLOB Converts NCLOB values in a LOB column or other character strings to CLOB values. TO_DATE Converts a NUMBER, CHAR, or VARCHAR2 to a DATE (an Oracle datatype). TO_DSINTERVAL Converts a character string of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 datatype to an INTERVAL DAY TO SECOND type. TO_LOB Converts a LONG to a LOB as part of an INSERT AS SELECT. TO_MULTI_BYTE Converts the single-byte characters in a character string to multibyte characters. TO_NCHAR Converts a character string, NUMBER, or DATE from the database character set to the national character set. TO_NCLOB Converts CLOB values in a LOB column or other character strings to NCLOB values. TO_NUMBER Converts a CHAR or VARCHAR2 to a number. TO_SINGLE_BYTE Converts the multibyte characters in a CHAR or VARCHAR2 to single bytes. TO_TIMESTAMP Converts a character string to a value of TIMESTAMP datatype. CONVERSION FUNCTIONS 1069 ORACLE Series TIGHT / Oracle Database 10g: TCR / Loney / 225351-7 / Chapter 1 Blind Folio 1:1069 P:\010Comp\Oracle8\351-7\CD\Ventura\Part9B.vp Friday, August 13, 2004 4:25:47 PM Color profile: Generic CMYK printer profile Composite Default screen Function Name Definition TO_TIMESTAMP_TZ Converts a character string to a value of TIMESTAMP WITH TIME ZONE datatype. TO_YMINTERVAL Converts a character string of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 datatype to an INTERVAL YEAR TO MONTH type. TRANSLATE…USING TRANSLATEs characters in a string into different characters. UNISTR Converts a string into Unicode in the database Unicode character set. CONVERT SEE ALSO CONVERSION FUNCTIONS FORMAT CONVERT(string,[destination_set,[source_set]]) DESCRIPTION CONVERT is used to convert the characters in string from one standard bit representation to another, such as from US7ASCII (the default if either set isn’t entered) to WE8DEC. This is typically done when data entered into a column on one computer contains characters that can’t be properly displayed or printed on another computer. CONVERT allows a reasonable translation of one standard to the other in most cases. The most common sets include: F7DEC DEC’s 7-bit ASCII set for France US7ASCII Standard U.S. 7-bit ASCII set WE8DEC DEC’s 8-bit ASCII set for Western Europe WE8HP HP’s 8-bit ASCII set for Western Europe WE8ISO8859P1 ISO 8859-1 Western Europe 8-bit character set WE8EBCDIC500 WE8PC850 IBM West European EBCDIC Code Page 500 IBM PC Code Page 850 COPY (SQL*Plus) NOTE The SQL*Plus COPY command is not being enhanced to handle datatypes or features introduced with, or after, Oracle8 i . The COPY command is likely to be made obsolete in a future release. SEE ALSO CREATE DATABASE LINK, Chapter 23 FORMAT COPY [FROM user / password@database ] [TO user / password@database ] {APPEND | CREATE | INSERT | REPLACE} table [ ( column [, column ] ) ] USING query 1070 Part IX: Alphabetical Reference ORACLE Series TIGHT / Oracle Database 10g: TCR / Loney / 225351-7 / Chapter 1 Blind Folio 1:1070 P:\010Comp\Oracle8\351-7\CD\Ventura\Part9B.vp Friday, August 13, 2004 4:25:49 PM Color profile: Generic CMYK printer profile Composite Default screen DESCRIPTION COPY copies FROM a table TO a table in another computer using Oracle Net. FROM is the username, password, and database of the source table, and TO is the destination table. Either FROM or TO may be omitted, in which case the user’s default database will be used for the missing clause. The source and destination databases must not be the same, so only one of the FROM and TO clauses may be absent. APPEND adds to the destination table; if the table does not exist, it is created. CREATE requires that the destination table be created; if it already exists, a 'table already exists' error occurs. INSERT adds to the destination table; if the table does not exist, a 'table does not exist' error occurs. REPLACE drops the data in the destination table and replaces it with the data from the source table; if the table does not exist, it is created. table is the name of the destination table. column is the name(s) of the column(s) in the destination table. If named, the number of columns must be the same as in the query. If no columns are named, the copied columns will have the same names in the destination table as they had in the source table. query identifies the source table and determines which rows and columns will be copied from it. SET LONG ( see SET) determines the length of a long field that can be copied. LONG columns with data longer than the value of LONG will be truncated. SET COPYCOMMIT determines how many sets of rows get copied before a commit. SET ARRAYSIZE determines how many rows are in a set. EXAMPLE This example copies BOOKSHELF_CHECKOUT from the EDMESTON database to the database the local SQL*Plus user is connected to. The table LOCAL_CHECKOUT is created by the copy. The columns may be renamed at the destination. Note the use of the dash (-) at the end of each line. This is required. The command does not end with a semicolon (since it is a SQL*Plus command, not a SQL command). See the SET command for options related to the COPY command. copy from PRACTICE/PRACTICE@EDMESTON - create LOCAL_CHECKOUT (Borrower, Title) - using select Name, Title - from BOOKSHELF_CHECKOUT COPYCOMMIT (SQL*Plus) See SET and COPY. COPYTYPECHECK (SQL*Plus) See SET and COPY. CORR SEE ALSO AGGREGATE FUNCTIONS FORMAT CORR ( expr1 , expr2 ) [OVER ( analytic_clause )] DESCRIPTION CORR returns the coefficient of correlation of a set of number pairs. Both expr1 and expr2 are number expressions. Oracle applies the function to the set of ( expr1 , expr2 ) after eliminating the pairs for which either expr1 or expr2 is NULL. Then Oracle makes the following computation: COVAR_POP( expr1 , expr2 ) / (STDDEV_POP( expr1 ) * STDDEV_POP( expr2 )) The function returns a value of type NUMBER. If the function is applied to an empty set, it returns NULL. CORR 1071 ORACLE Series TIGHT / Oracle Database 10g: TCR / Loney / 225351-7 / Chapter 1 Blind Folio 1:1071 P:\010Comp\Oracle8\351-7\CD\Ventura\Part9B.vp Friday, August 13, 2004 4:25:50 PM Color profile: Generic CMYK printer profile Composite Default screen CORR SEE ALSO CORR_K and CORR_S FORMAT CORR ( expr1 , expr2 ) OVER ( analytic clause ) DESCRIPTION CORR returns the coefficient of correlation on a set of number pairs. CORR can be used as an aggregate or analytic function. CORR_K and CORR_S SEE ALSO CORR FORMAT {CORR_K | CORR_S } ( expr1 , expr2 [, { COEFFICIENT |ONE_SIDED_SIG|TWO_SIDED_SIG}]) DESCRIPTION The CORR_K and CORR_S functions support nonparametric or rank correlations. Correlation coefficients take a value ranging from 1 to –1 where 1 indicates a perfect relationship and –1 a perfect inverse relationship. The arguments must either be numeric or implicitly converted to a numeric datatype. ONE_SIDED_SIG is for one-tailed significance of the correlation, TWO_SIDED_SIG is for two-tailed significance. CORRELATED QUERY A correlated query is a subquery that is executed repeatedly, once for each value of a candidate row selected by the main query. The outcome of each execution of the subquery depends on the values of one or more fields in the candidate row; that is, the subquery is correlated with the main query. See Chapter 13. COS SEE ALSO ACOS, ASIN, ATAN, ATAN2, COSH, EXP, LN, LOG, SIN, SINH, TAN, TANH FORMAT COS( value ) DESCRIPTION COS returns the cosine of a value, an angle expressed in radians. You can convert a degree angle into radians by multiplying it by pi/180. COSH SEE ALSO ACOS, ASIN, ATAN, ATAN2, COS, EXP, LN, LOG, SIN, SINH, TAN, TANH FORMAT COSH( value ) DESCRIPTION COSH returns the hyperbolic cosine of a value . 1072 Part IX: Alphabetical Reference ORACLE Series TIGHT / Oracle Database 10g: TCR / Loney / 225351-7 / Chapter 1 Blind Folio 1:1072 P:\010Comp\Oracle8\351-7\CD\Ventura\Part9B.vp Friday, August 13, 2004 4:25:51 PM Color profile: Generic CMYK printer profile Composite Default screen [...]... will return an error The SET option changes the name of the database, specified by the DATABASE clause The LOGFILE clause specifies the redo log file groups, all of which must exist The RESETLOGS versus NORESETLOGS clause tells Oracle to reset the current logs or not The DATAFILE line specifies the datafiles for the database, all of which must exist The MAXLOGFILES option specifies the maximum number... non-SYSTEM tablespace as the default temporary tablespace for all new users created in the database As of Oracle Database 10g, you can use the CREATE DATABASE command to do the following: ■ ■ ■ ■ Create a default permanent tablespace for the database Specify datafiles for the SYSAUX tablespace Specify a bigfile tablespace as the default for the database Override the default for the undo and default temporary... The MAXLOGMEMBERS option specifies the number of copies for a redo log group The MAXLOGHISTORY option specifies the number of archived redo log file groups for Real Application Clusters The MAXDATAFILES option specifies the maximum number of datafiles that can ever be created for the database The MAXINSTANCES option gives the maximum number of Oracle instances that can mount and open the database The. .. create a database link, you must have CREATE DATABASE LINK privilege in the local database, and the CREATE SESSION privilege in a remote database To create a public database link, you must have the CREATE PUBLIC DATABASE LINK system privilege If you use the CONNECT TO CURRENT_USER clause, the link will attempt to open a connection in the remote database by using your current username and password You therefore... the CREATE PUBLIC DATABASE LINK system privilege, but are then available to all users except those who have created a private link with the same name If PUBLIC isn’t specified, the link is only available to the user who executed the CREATE DATABASE LINK statement connect_string is the Oracle Net service name for the remote database Remote tables can be accessed just like local tables, except that the. .. specify the hash cluster form, however, you don’t need to (and can’t) create an index on the cluster key Instead, Oracle uses a hash function to store the rows of the table You can create your own hash value as a column of the table and use that for hashing with the HASH IS clause to tell Oracle to use that column as the hash value Otherwise, Oracle uses an internal hash function based on the columns of the. .. between the local database and the remote database, or else database links may stop working If you use the shared server architecture, you can create SHARED database links that eliminate the need for many separate dedicated connections via links When you create a SHARED link, you must supply a valid username and password in the remote database to use as an authentication for the connection EXAMPLES The. .. Bitmap join indexes use the FROM and WHERE clauses to specify the tables involved and the join conditions REVERSE stores the bytes of the indexed value in reverse order You cannot reverse a bitmap index P:\010Comp \Oracle8 \351-7\CD\Ventura\Part9B.vp Friday, August 13, 2004 4:26:05 PM 1 091 ORACLE Series TIGHT / Oracle Database 10g: TCR / Loney / 225351-7 / Chapter 1 Blind Folio 1:1 092 Color profile: Generic... namespace for a context and associates the namespace with the externally created package that sets the context To create a context namespace, you must have the CREATE ANY CONTEXT system privilege CREATE CONTROLFILE SEE ALSO ALTER DATABASE, CREATE DATABASE P:\010Comp \Oracle8 \351-7\CD\Ventura\Part9B.vp Friday, August 13, 2004 4:25:53 PM 1075 ORACLE Series TIGHT / Oracle Database 10g: TCR / Loney / 225351-7 /... requires at least one cluster column from each of the tables These must have the same datatype and size, but are not required to have the same name For the tables in a cluster, rows with the same cluster column values are kept together on disk in the same area, the same logical block(s) This can improve performance when the cluster columns are the columns by which the tables are usually joined Each distinct . from the EDMESTON database to the database the local SQL*Plus user is connected to. The table LOCAL_CHECKOUT is created by the copy. The columns may be renamed at the destination. Note the use. specify the name of an existing control file but do not use the REUSE option, the command will return an error. The SET option changes the name of the database, specified by the DATABASE clause. The. in the database. As of Oracle Database 10 g , you can use the CREATE DATABASE command to do the following: ■ Create a default permanent tablespace for the database ■ Specify datafiles for the

Ngày đăng: 08/08/2014, 20:21

Từ khóa liên quan

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

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

Tài liệu liên quan