create sequence table1_id
minvalue 1
nomaxvalue
increment by 1
start with 1
nocache;
create or replace procedure test_p(v_id out int, v_name varchar(10))
as
begin
select table1_id.nextval into v_id from dual;
insert into test values(v_id,v_name);
end;
declare
i int;
begin
call test_p(i,‘test’);
print i;
end;
–达梦是多版本并发控制的,select不会被阻塞,您可以用序列来实现
create table test(id int ,name varchar(10));
create sequence table1_id
minvalue 1
nomaxvalue
increment by 1
start with 1
nocache;
create or replace procedure test_p(v_id out int, v_name varchar(10))
as
begin
select table1_id.nextval into v_id from dual;
insert into test values(v_id,v_name);
end;
declare
i int;
begin
call test_p(i,‘test’);
print i;
end;