如下sequence在10g中使用时会报错,但是在11g中使用时,一切OK.1.
create sequence test_seq start with 1 increment by 1;
set serveroutput on;
declare
v_seq number;
begin
v_seq := test_seq.nextval();
dbms_output.put_line('v_seq value:'||v_seq);
end;
/
2.
create sequence test_seq start with 1 increment by 1;
set serveroutput on;
declare
v_seq number;
v_start_time number;
v_end_time number;
begin
v_start_time := dbms_utility.get_time;
for i in 1..1000 loop
select test_seq.nextval into v_seq from dual;
end loop;
v_end_time := dbms_utility.get_time;
dbms_output.put_line('Elapsed time to retrieve sequence via SELECT INTO:'||(v_end_time - v_start_time));
v_start_time := dbms_utility.get_time;
for i in 1..1000 loop
v_seq := test_seq.nextval;
end loop;
v_end_time := dbms_utility.get_time;
dbms_output.put_line('Elapsed time to retrieve sequence via PL/SQL expression:'||(v_end_time - v_start_time));
end;
/
阅读(2630) | 评论(0) | 转发(0) |