oracle 自增列 & 创建表空间
2013-07-11 16:57
239 查看
一 建序列
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 = '表空间名区分大小写'
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 = '表空间名区分大小写'
相关文章推荐
- oracle 创建表空间、用户
- Oracle创建之路->创建表空间、创建临时表空间、创建用户、授权
- Oracle 创建表空间,用户,权限分配脚本
- oracle创建表空间
- ORACLE启动、创建表空间、导出导入数据
- oracle创建表空间详解
- Oracle创建删除用户、角色、表空间、导入导出、...命令总结
- ORACLE创建表空间、创建用户、更改用户默认表空间以及授权、查看权限(修改表空间大小)
- Oracle如何创建表空间
- Oracle创建用户、表空间及为用户指定表空间
- Oracle笔记 五、创建表、约束、视图、索引、序列、同义词、表空间
- oracle创建表空间
- Oracle创建用户、表空间、导入导出、...命令
- [oracle] 创建表空间、建用户、授权语句
- Oracle 使用sql创建表空间及用户
- 使用sqlplus命令行工具为oracle创建用户和表空间
- oracle 之创建用户,表空间,授权,修改用户密码
- oracle创建表空间语句
- Oracle创建表空间、创建用户以及授权、查看权限
- Oracle创建用户以及创建表空间以及个用户授予权限和plsql远程查看表空间创建路径