HomeSearchE-MailPrint
French English Chinese
SUPINFO website, The International Institute of Information Technology

Sequences management within a PL/SQL expression

Votes: 1

Comments: 0

Visits: 595

PL/SQL 16-MAY-2008 11:43 AM, Xavier Toutoute-Fauconnier

Generally speaking, SEQUENCE objects provide a sequential serie of numbers used for primary and unique keys.
In order to refer to the sequence values in SQL statements, we use CURRVAL and NEXTVAL pseudocolumns to respectively return the sequence's current value and increment it. Examples always make things clearer!

SELECT deptid.CURRVAL    --returns the current deptid value
INTO d_deptid
FROM DUAL;


SELECT deptid.NEXTVAL    --returns the next deptid value
INTO d_deptid
FROM DUAL;


However, both CURRVAL and NEXTVAL couldn't be used within a PL/SQL expression with Oracle's previous releases.
Oracle was aware of that problem. Therefore, Oracle Database 11g now introduces CURRVAL and NEXTVAL support within PL/SQL code.
Thus, simply proceed like this:

d_deptid := deptid.CURRVAL; --returns the current deptid value  

d_deptid := deptid.NEXTVAL; --returns the following deptid value  

Source: Quest-Pipelines.com
Next Previous

Comments

Login to leave a comment.

Articles

Oracle Installation on SUSE Linux Enterprise Server

Administration 14-JUN-2008 07:03 PM, Fabien Loudet

We will follow step-by-step the installation of Oracle Database 10g on SUSE Linux Enterprise Server. We choose here to install Oracle Enterprise Edition and create a database.


Articles RSS
Source Codes

Add Multi-language support

Portal 25-NOV-2004 10:30 AM, Pierre-Henry Tupin

Instant Messenger

Communication 24-NOV-2004 10:31 AM, Arnaud Bontemps

Who is online

Portal 24-NOV-2004 10:26 AM, Arnaud Bontemps

Change the Portal CSS

Portal 15-JUN-2004 04:15 PM, Arnaud Bontemps, Yoan Sultan


Source Codes RSS
News

Oracle launched development tools support: NET 3.5 and VS2008

19-JUL-2008 08:58 PM, ZHENG Na

Oracle has launched Oracle Developer Tools with Oracle 11g ODAC 11.1.0.6.20

MySQL occupies Oracle market the problem is technical support

19-JUL-2008 08:44 PM, ZHENG Na

According to foreign reports, Oracle's recent user survey shows that the open source software is occupying the installation share of Oracle database software, about 60 percent of the IT infrastructures is ...

China's powerful enterprises have adopted Oracle Enterprise Asset Management solutions to accelerate operations

12-JUL-2008 06:26 PM, WANG Hongyu

The solution greatly improves operational efficiency and asset investment rate of return.

Oracle carries on linux service, devotes its mind to “worth open source”

04-JUL-2008 09:57 AM, WANG Liming

Open source market is developing healthy, and it holds ocean development space. This can be displayed from the current research of IDC.

Oracle High-speed cache memory database software on the market

01-JUL-2008 05:22 PM, DONG Zhen

Beijing, April 8, 2008-Oracle Corporation today announced that the U.S. headquarters, Oracle database cache memory (Oracle In-Memory Database Cache) software market, the software is the enterprise version of ...


News RSS