1. Create a new table
CREATE TABLEYsb_log (ID Number(8)Primary Key not NULL, Tbdatevarchar( -)NULL, Tb_timevarchar( -) not NULL, Tblogvarchar( -) not NULL, Tbreorvarchar2( -)NULL, BSvarchar( -) not NULL );
In Oracle, sequence is the so-called serial number, which is automatically incremented each time it is taken, and is typically used where serial numbers need to be sorted.
2. Create a self-increment
Create1 99999999--the largest paper with 1 by 1 -- keep accumulating, not looping -- do not build buffers
Select S_ysb_log. Currval from dual---to search for the current primary key value,
Select S_ysb_log. Nextval from dual--query the next value
3. Insert data into the table:
Insert into ysb_log (ID, tbdate, tb_time, Tblog, Tbreor, BS)values'2016-7-21', ' 10:01:00 ','dddd',null'orderdown' )
places where you can use sequence:
-SELECT statements that do not contain subqueries, snapshot, and view
-INSERT statement in subqueries
-In the values of the Nsert statement
-In the set of UPDATE
Oracle SQL CREATE TABLE Oracle build tables Set PRIMARY key auto-increment