oracle 自增列 & 创建表空间
一 建序列
create sequence squence_name
increment by 1 --按1增长
start with 1 --从1开始
nomaxvalue --不设最大值
nocycle --不循环
cache 10; --缓冲
create sequence seq_fxc_tsxx_vio_xh increment by 1--按1增长
start with 1--从1开始
nomaxvalue nocycle cache 10;
二 相应表上建触发器应用序列
create or replace trigger trigger_name
before insert on tableName
for each row
begin
select squence_name.nextval into :new.id from dual; --:new.id id 为需要自增的列
end;
-------------------------------------------------------------创建表空间
create tablespace tsName datafile 'd:\??.dbf'
size 10M autoextend
on next 10M maxsize
unlimited
-------------------------------------------------------------查看当前用户表空间
select username,default_tablespace from user_users;
-------------------------------------------------------------查看当前用户表空间路径
select * from dba_data_files where tablespace_name = '表空间名区分大小写'