Quick Search:
Oracle PL/SQL Code Library
Find Or Post Oracle Jobs
Oracle Discussion & Chat
 Oracle PL/SQL: SEQUENCE: get sequence value into variable Jump to:  
Category: >> Oracle PL/SQL >> SEQUENCE: get sequence value into variable Bookmark and Share

<< lastnext >>

Snippet Name: SEQUENCE: get sequence value into variable

Description: Oracle doesn't let you use sequences directly from PL/SQL. This is how to get a sequence value into a PL/SQL variable.

Also see:
» SEQUENCE: Demo code and Examples
» Declaring Variables
» SEQUENCE: Find sequence MAX value
» SEQUENCE: Reset a sequence to a predef...
» SEQUENCE: get sequence value into vari...
» SEQUENCE: Autonumber into two tables
» SEQUENCE: Create sequence demo
» Create Sequence
» Anonymous blocks - Constants and Varia...

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 06th, 2009

-- you cannot use sequences directly from PL/SQL. 
-- Oracle prohibits this type of usage: 
i := sq_sequence.NEXTVAL;  - won't work!
-- but you can use embedded SQL statements to 
-- obtain sequence values:
select sq_sequence.NEXTVAL into :i from dual; -- works

Oracle Magazine
and Oracle White Papers

SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 30 users online    © 2009 psoug.org

Forgot your password?