& oracle-- view sequence index &

--oracle learning content
management system learning --oracle of
--oracle data management learning
--oracle user management
--oracle two-dimensional table management
other --oracle knowledge of
  the sequence of --oracle, views, indexes
  --oracle the paging query
  the database backup of --oracle

Use sequence 
							1, sequence create sequence create sequence name 
								features: no initial default values, the default value nextval from 1, the default each time increment +1 
								features: You can use the sequence name .nextval take the primary key using 
							create sequence CNUM; 
							the SELECT cnum.currval from dual --- get the current sequence value 
							select cnum.nextval from dual --- since the sequence returns the current value increases 
							 
							TRUNCATE Table clazz 
							SELECT * from clazz 
							INSERT INTO clazz values (cnum.nextval, '402 class'' the most polluted teacher of the class'); - the sequence as the primary key 
						question 2: If the current table has a lot of data, but the next step is to use the primary key sequence increment? 
							And the initial value of the specified sequence when creating step sequence Create Sequence CC 
							Start with 90 --- setting sequence initial value 
							increment by 5 --- set step size 
							insert into clazz values (cc.nextval, ' 402 class',' Teacher most sewage classes'); 
							SELECT max (CID) from clazz
							
 
							-
							select cc.nextval from dual
							select cc.currval from dual
							select * from clazz
						删除序列
							drop sequence cc

  

Guess you like

Origin www.cnblogs.com/eadela/p/11493188.html