Chinaunix首页 | 论坛 | 博客
  • 博客访问: 980945
  • 博文数量: 358
  • 博客积分: 8185
  • 博客等级: 中将
  • 技术积分: 3751
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-15 16:27
个人简介

The views and opinions expressed all for my own,only for study and test, not reflect the views of Any Company and its affiliates.

文章分类

全部博文(358)

文章存档

2012年(8)

2011年(18)

2010年(50)

2009年(218)

2008年(64)

我的朋友

分类: Oracle

2009-07-07 22:52:29

■Object Types:
SQL> select object_type from dba_objects group by object_type;
CONSUMER GROUP
INDEX PARTITION
SEQUENCE
QUEUE
SCHEDULE
TABLE PARTITION
RULE
JAVA DATA
PROCEDURE
OPERATOR
LOB PARTITION
WINDOW
LOB
PACKAGE
PACKAGE BODY
LIBRARY
RULE SET
PROGRAM
TYPE BODY
CONTEXT
JAVA RESOURCE
XML SCHEMA
TRIGGER
JOB CLASS
UNDEFINED
DIRECTORY
TABLE
INDEX
SYNONYM
VIEW
FUNCTION
WINDOW GROUP
JAVA CLASS
INDEXTYPE
CLUSTER
TYPE
RESOURCE PLAN
EVALUATION CONTEXT
JOB

已选择39行。

■■■■Tables
■Naming Rules:
・ The name may be from 1 to 30 characters long (with the exception of database link names that may be up to 128 characters long).
・ Reserved words (such as SELECT) cannot be used as object names.
・ All names must begin with a letter from “A” through “Z.”
・ The characters in a name can only be letters, numbers, an underscore (_),the dollar sign ($), or the hash symbol (#).
・ Lowercase letters will be converted to uppercase.
■Object Namespaces
namespace A Name space defines agroup of object types,within which all names must be uniquely identified,by schema and name. Objecet in different namespace can share the same name.
These object types share the same namespace:
・Tables ・Views ・Sequences ・Private synomyms
Indexes and Constraints each have their own namespaces.
Thus it is possible for an index to have the same name as a table,even within the same schema;
■Create table
■Data Types
alphanumeric data:
  VARCHAR2,NVARCHAR2,CHAR
・binary data:
  RAW(×),NUMBER,FLOAT,INTEGER
・date and time data:
 DATE,TIMESTAMP,TIMESTAMP WITH TIMEZONE,TIMESTAMP WITH LOCAL  TIMEZONE,INTERVAL YEAR TO MONTH,INTERVAL DAY TO SECOND
・large object data types:
 CLOB,NCLOB,BLOB,BFILE,LONG(×),LONG RAW(×)
・ROWID data type:
 ROWID
■Constraints
 UNIQUE
 NOT NULL
 PRIMARY KEY
 FOREIGN KEY
   ON DELETE CASCADE;ON DELETE SET NULL
      eg:
REFERENCES [ schema. ] { object_table | view }
[ (column [, column ]...) ]
[ON DELETE { CASCADE | SET NULL } ]
[ constraint_state ]
 CHECK
 ・A primary key constraint is a unique constraint combined with a not null constraint.
 ・A foreign key constraint in a child table must reference the columns of either a unique constraint or a primary key constraint in the parent table.

■Alter table
Read-only tables:
alter table XXX READ ONLY;
alter table XXX READ WRITE;
■Drop table
・Moves a tables to the recycle bin
・Removes the table and all its data entirely if PURGE
 syntax:
   DROP TABLE [ schema. ]table
   [ CASCADE CONSTRAINTS ]
   [ PURGE ] ;
■Rename




阅读(571) | 评论(0) | 转发(0) |
0

上一篇:Manipulating Data

下一篇:Other Schema Objects

给主人留下些什么吧!~~