Oracle获取序列值

一、Sql直接读取

select 'SeqName'.NEXTVAL  from dual

二、Func函数

create or replace function GetSequenceFunc( seqName in char)
return int
AS
        sqlstr varchar(100);
        seqValue number(20);
begin
        sqlstr := 'select '||seqName||'.nextval from dual';
        execute immediate sqlstr into seqValue;
        return(seqValue);
end GetSequenceFunc;

三、存储过程

create or replace procedure GetSequenceProc
(
seqName in varchar2,
seqNextValue out number
)
as
sqlstr varchar(50);
begin
  sqlstr:='select '||seqName||'.nextval from dual';
 execute immediate sqlstr into seqNextValue;
end;

 

上一篇:查看oracle中的中文所占字节数


下一篇:oracle-函数