Oracle创建序列存储过程
2012-09-14 20:59
302 查看
create or replace procedure createSequence(tableName in varchar2) is indexStart number ; cou number ; tName varchar2(200); str varchar2(8000); begin tName:= tableName; str:= 'select count(*) as int from tab where tname=upper('''|| tName||''')' ; dbms_output.put_line(str); execute immediate str into cou ; if cou>0 then begin str:= 'select nvl(max(id),0)+1 from ' || tableName ; execute immediate str into indexStart ; str:='create sequence SEQUENCE_' || tName || ' minvalue 1 maxvalue 999999999999999999999999999 start with '|| indexStart ||' increment by 1 nocache'; dbms_output.put_line(str); execute immediate str; end; end if ; end createSequence;
测试语句:
SELECT SEQUENCE_TABLENAME.NEXTVAL FROM DUAL;
相关文章推荐
- Oracle创建表,注释,视图,序列,同义词,触发器,存储过程举例
- oracle用存储过程创建序列时权限不足问题
- oracle序列的创建与使用
- oracle序列创建
- <四>Oracle创建sequence序列,实现主键自增长
- Oracle 表创建序列-触发 实现表ID自动增长
- oracle 创建存储过程
- Oracle笔记 五、创建表、约束、视图、索引、序列、同义词、表空间
- oracle 建表 造数据 存储过程 创建数据库的远程连接 以及一列的多行合并
- Oracle删除当前用户下的所有表、视图、序列、函数、存储过程、包
- oracle 中序列的创建
- 创建oracle自增序列
- oracle 序列的创建与使用
- Oracle序列(Sequence)创建、使用、修改、删除
- Oracle删除当前用户下的所有表、视图、序列、函数、存储过程、包
- oracle 存储过程 函数 创建 删除 参数 传递 函数 查看 包 系统包
- Oracle笔记 五、创建表、约束、视图、索引、序列、同义词、表空间
- oracle 创建包和存储过程并调用举例
- Oracle创建表语句(Create table)语法详解及示例、、 C# 调用Oracle 存储过程返回数据集 实例
- Oracle 创建序列