pgsql里的存储函数是这样的:
create or replace function public.f_newid()
returns bigint
language plpgsql
as $function$
begin
return nextval('wasys_guid');
end;
$function$;
上面是pgsql的写法,wasys_guid是序列名字,换到达梦里该怎么写呢
--创建序列
create sequence wasys_guid increment by 1 start with 1 nomaxvalue nocache nocycle;
--创建函数
create or replace function f_newid return bigint
as
next_value bigint;
begin
select WASYS_GUID.nextval into next_value from dual;
return next_value;
end;
--调用
select f_newid();
达梦的存储过程语法和Oracle高度兼容,而返回序列的下一个值的使用方法为:
select 序列名.nextval from dual;