Chinaunix首页 | 论坛 | 博客
  • 博客访问: 91908131
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: Oracle

2008-04-30 18:33:26

创建序列
create sequence seq_a minvalue 1000 maxvalue 99999999 start with 1000 increment by 1 nocache;


查询序列
select seq_a.nextval from dual;


为每张表生成对应的序列

--创建存储过程
create or replace procedure p_createseq(tablename in varchar2)
is
strsql varchar2(500);
begin
strsql:='create sequence seq_'||tablename||' minvalue 1000 maxvalue 99999999 start with 1000 increment by 1 nocache';
execute immediate strsql;
end p_createseq;
/

--创建序列
exec p_createseq('t_power');
exec p_createseq('t_roler');
exec p_createseq('t_roler_power');
exec p_createseq('t_department');
exec p_createseq('t_quarters');
exec p_createseq('t_quarters_roler');
exec p_createseq('t_emp');
exec p_createseq('t_require_plan');
exec p_createseq('t_require_minutia');
exec p_createseq('t_require_audit');
exec p_createseq('t_engage');
exec p_createseq('t_home');
exec p_createseq('t_education');
exec p_createseq('t_works');
exec p_createseq('t_skill');
exec p_createseq('t_account');
exec p_createseq('t_licence');
exec p_createseq('t_title');
exec p_createseq('t_remove');
exec p_createseq('t_train');
exec p_createseq('t_pact');
exec p_createseq('t_assess');
exec p_createseq('t_attendance');
exec p_createseq('t_reward_punish');
exec p_createseq('t_dimission');
exec p_createseq('t_emp_roler');
exec p_createseq('t_code');

原文:http://louisyoo.blog.ccidnet.com/blog-htm-itemid-117265-do-showone-type-blog-uid-41414.html

阅读(225) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~