Oracle's Data Objects

Source: Internet
Author: User

Oracle's data objects include tables, views, constraints, sequences, indexes, functions, stored procedures, packages, and triggers.

Here are the main introduction to views, sequences, indexes, triggers, stored procedures

A view is a logical table that is based on a table or multiple tables or views, which itself does not contain data that can be queried and modified by the data in the table.

There is no index on the general view, and the operation of the views is ultimately translated into operations on the table.

1 CREATE [OR REPLACE] [force| Noforce] ---Force: The view is automatically created by Oracle regardless of the presence of the base table;2                                    ----Noforce: Only the base table exists for Oracle to create this view3 VIEWView_name[(alias[, alias]...)]----Aliases for column definitions generated for the view4 5  asSubquery----A complete SELECT statement in which the alias can be defined6 7 [With CHECK OPTION [CONSTRAINT CONSTRAINT]]----The data rows inserted or modified must meet the constraints of the view definition8 9 [With READ only] ----No DML operation on this viewTen  One --For example A Create or Replace ViewMyView (ename,job,sal,dname) -  as - SelectEname,job,sal,dname fromemp,dept the whereEmp.deptno=Dept.deptno -  with Read  only;

A sequence is a database object provided by Oacle to produce a series of unique numbers.

The sequence is primarily to provide the table's primary key value.

Syntax for the sequence:

1 CREATESEQUENCE SEQUENCE//Create a sequence name2 3        [INCREMENT by N]  //The incremented sequence value is N if n is a positive number increment, and if it is negative, the default is 1.4 5        [START with N]    //The starting value, incrementing by default, is MinValue decrement is MaxValue6 7        [{MAXVALUE N | Nomaxvalue}] //Maximum Value8 9        [{MINVALUE N | Nominvalue}] //Minimum ValueTen  One        [{CYCLE | Nocycle}] //Cycle/No loops A  -        [{CACHE N | NOCACHE}];//allocation and coexistence into memory - -------------------------------------------------- the --For example:------------------------------------------ - CreateSequence Myseq Start with 1 -Increment by 1MaxValue - -CacheTenCycle

The new sequence, using the value of the sequence must first call the Nextval value of the sequence, otherwise it will error.

If the starting value of MYSEQ is 1, the first time the select Myseq.nextval from dual is executed, the value is 1

Select Myseq.currval from dual; The current value of the sequence

The concept of an index

1, similar to the directory structure of the book;

2, Oracle's "Index" object, the optional object associated with the table, improve the speed of SQL query statements;

3. The index directly points to the location of the row containing the queried value, reducing disk I/O;

4, with the index of the table is independent of the physical structure;

5, Oracle automatically use and maintain the index, INSERT, delete, update the table, automatically update the index;

6. Syntax: CREATE index index on table (column[, column] ...);

7, B-tree structure (non-bitmap);

Reference to the specific explanation of the index:

https://www.oschina.net/question/30362_4057

Triggers are divided into statement-level triggers and row-level triggers

Statement-level triggers can be triggered before or after certain statements are executed;

A row-level trigger is triggered once when the row data in the triggered table is defined.

Reference Links:

Http://www.cnblogs.com/linjiqin/archive/2012/04/01/2429144.html

8023740/

Stored Procedures

Oracle's Data Objects

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.