Sequence and synonym

xiaoxiao2021-03-05  30

/ * Sequence * /

Like the sequence, the actual storage space is not occupied, just saved its definition in the database.

Create sequence create sequence EMP_SEQINCREMENT by 1start with 1NomaxValuenoClecache 10

Reference Sequence Insert Into Empvalues ​​(EMP_SEQ.NEXTVAL, 'ZHAOKEE')

You can use the following query to see the current value of the EMP_SEQ sequence: SQL> SELECT EMP_SEQ.CURRVAL from DUAL

CURRVAL ---------- 1

Note: Before the first reference CURRVAL pseudo column, the NEXTVAL pseudo column of a sequence must be referenced for the value of the pre-initialization sequence.

Modify sequence (not modified start value) ALTER sequence EMP_SEQINCREMENT BY 10MaxValue 10000CYCLECAHCHE 20

Delete Sequence DROP SEQUENCE EMP_SEQ

Sequence Data Dictionary DBA_SEQUENCES / ALL_SEQUENCES / USER_SEQUENCES

/ * Synonym * /

Synonyms are an alias for tables, indexes, and views or other mode objects

Oracle can create two types of synonyms: * Public synonym: Public synonym is owned by a special user group public, all users in the database can use public synonyms to create a public synonym must have Create Public Synonym system permission * Private Synonym: Private synonym is owned by creating its user or mode, users can control whether other users have permission to use their own private synonyms

Create synonym create synonym cls for classcreate public synonym pub_emp for jward.emp

Delete synonym Drop synynym clsdrop public synonym pub_emp (must have Drop public Synonym system permission)

Synonyms Data Dictionary All_Synynyms / DBA_SYNONYMS / User_Synonyms

转载请注明原文地址:https://www.9cbs.com/read-34169.html

New Post(0)