ITPub博客

首页 > Linux操作系统 > Linux操作系统 > sequence两个实例,sequence没有重复,但是相两个值可以相差很大

sequence两个实例,sequence没有重复,但是相两个值可以相差很大

原创 Linux操作系统 作者:DataKW 时间:2013-06-03 10:25:27 0 删除 编辑
sequence两个实例,sequence没有重复,但是相两个值可以相差很大
select '1'||''||to_char(s_t_log_reconciliation.nextval,'fm0000000000000000000') as record_no from dual;
不同实例上查看:
                   10000000000018274733
                   10000000000018274901
 
create sequence S_temp_LOG_RECONCILIATION
minvalue 1
maxvalue 9999999999999999
start with 1
increment by 1
cache 100;
create table temp_0603a(seqs varchar2(20));
create table temp_0603b(seqs varchar2(20));

-- Created on 2013-5-31 by ZHONGYANMING
declare
  -- Local variables here
  i integer;
begin
  -- Test statements here
  for j in 1..100000 loop
insert into temp_0603a select '1'||''||to_char(s_temp_log_reconciliation.nextval,'fm0000000000000000000') as record_no from dual;
commit;
end loop;
end;

-- Created on 2013-5-31 by ZHONGYANMING
declare
  -- Local variables here
  i integer;
begin
  -- Test statements here
  for j in 1..100000 loop
insert into temp_0603b select '1'||''||to_char(s_temp_log_reconciliation.nextval,'fm0000000000000000000') as record_no from dual;
commit;
end loop;
end;

select * from temp_0603a;
select * from temp_0603b;
select * from temp_0603a a,temp_0603b b where a.seqs=b.seqs;
没有相同的,说明没有取重复的数据
alter table temp_0603a add cum varchar2(1);
alter table temp_0603b add cum varchar2(1);
update temp_0603a set cum='a';
update temp_0603b set cum='b';
select * from temp_0603a a,temp_0603b b where a.seqs>=b.seqs;
每个实例上的序列都是从0-100开始的(前面用过了,不会影响100结束)

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/27573546/viewspace-762783/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: AIX系统维护大全
请登录后发表评论 登录
全部评论

注册时间:2012-08-12

  • 博文量
    132
  • 访问量
    331526