两种方法
方法一:
用触发器建一个序列
create sequence a_seq increment by 1 start with 100;
建一个触发器, 自动+1
create or replace trigger your_seq_tri
before insert on your_table1 for each row
declare
next_id number;
begin
select your_seq.nextval into next_id from dual;
:new.id := next_id;
end;
方法二:
建一个序列
create sequence a_seq increment by 1 start with 100;
在语句中+1
insert into tbl(id,....)
values (a_seq.nextval,....)
方法一:
用触发器建一个序列
create sequence a_seq increment by 1 start with 100;
建一个触发器, 自动+1
create or replace trigger your_seq_tri
before insert on your_table1 for each row
declare
next_id number;
begin
select your_seq.nextval into next_id from dual;
:new.id := next_id;
end;
方法二:
建一个序列
create sequence a_seq increment by 1 start with 100;
在语句中+1
insert into tbl(id,....)
values (a_seq.nextval,....)
解决方案 »
- oracle中插入年月日时分秒类型数据,该用什么类型
- ORA-12518: TNS: 监听程序无法分发客户机连接
- 访问程序包DBMS_APPLICATION_INFO 时出错
- 请问关于数据库主键的一些问题
- oracle9i在win2003上安装的问题
- oracle 9i的客户端可以连接oracle 8.0.0.5的服务器端吗?
- Oracle8.1.7在linux Redhat7.2上的安装问题(在线等待)
- Oracle的数据文件是不是.dbf?如果从其它机子拷了一个.dbf进来,放在oradata内,那么需执行什么命令才能在DBA Studio中看到这个新的数据
- oracle 11g 在不区分大小写的情况下,求出邮件地址中包含姓的员工信息。其中邮件以首字母大写的形式返回 怎么弄?
- 将excel导入oracle,数据显示异常
- (救)在 Oracle9i 中,为什么我的数据库备份不了?(急)
- oracle恢复数据问题
NVL(A,B) 相当于 if a=null then return b