dbTalk Databases Forums  

Improved sequence management

comp.databases.oracle.server comp.databases.oracle.server


Discuss Improved sequence management in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
paddy_nyr
 
Posts: n/a

Default Improved sequence management - 11-09-2010 , 01:41 PM






What does this mean?

How would I use a sequence value?

A new features of Oracle 11g will bypass DML (sequence.nextval) and allow
normal assignments on sequence values.

Reply With Quote
  #2  
Old   
ddf
 
Posts: n/a

Default Re: Improved sequence management - 11-09-2010 , 02:22 PM






On Nov 9, 2:41*pm, "paddy_nyr" <philpott.patr... (AT) gmail (DOT) com> wrote:
Quote:
What does this mean?

How would I use a sequence value?

A new features of Oracle 11g will bypass DML (sequence.nextval) and allow
normal assignments on sequence values.
Old way:

declare
p_seqval number;
begin
select myseq.nextval into p_seqval from dual;
end;
/

New way:

declare
p_seqval number;
begin
p_seqval := myseq.nextval;
end;
/


David Fitzjarrell

Reply With Quote
  #3  
Old   
Mladen Gogala
 
Posts: n/a

Default Re: Improved sequence management - 11-09-2010 , 03:37 PM



On Tue, 09 Nov 2010 14:41:14 -0500, paddy_nyr wrote:

Quote:
What does this mean?

How would I use a sequence value?

A new features of Oracle 11g will bypass DML (sequence.nextval) and
allow normal assignments on sequence values.
This is what it means:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing
options

SQL> create sequence test_seq start with 1 cache 2048;

Sequence created.

Elapsed: 00:00:00.09
SQL> declare
2 a number(10,0);
3 begin
4 a:=test_seq.nextval;
5 dbms_output.put_line('A is:'||a);
6 end;
7 /
A is:1

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.07
SQL> /
A is:2

SQL> save /tmp/1
Created file /tmp/1.sql
SQL> connect scott/tiger@stag3
Connected.
SQL> create sequence test_seq start with 1 cache 2048;

Sequence created.

Elapsed: 00:00:00.15
SQL> @/tmp/1
a:=test_seq.nextval;
*
ERROR at line 4:
ORA-06550: line 4, column 13:
PLS-00357: Table,View Or Sequence reference 'TEST_SEQ.NEXTVAL' not
allowed in
this context
ORA-06550: line 4, column 1:
PL/SQL: Statement ignored


Elapsed: 00:00:00.10
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE 10.2.0.5.0 Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production

Elapsed: 00:00:00.13



--
http://mgogala.byethost5.com

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.