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

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博客 ” ,链接:http://blog.itpub.net/27573546/viewspace-762783/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/27573546/viewspace-762783/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值