File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Using Sequence to populate ID(SOLVED)
Joined: Apr 04, 2009
Feb 23, 2011 08:25:45
I have never used sequences in pl sql before, so I am just wondering if it is best practice to use seq.nextval or seq.currval?
I do not know if using .currval will use the current number, and then the next time it is used ti will use the next number in line, or if .currval will keep using the same number over and over again.
Thanks for any advice
edit - I know I can easily answer this question by
it out, but I am also looking for any best practice tips for using sequences since I have never used one.
True wisdom is in knowing you know nothing - Socrates
Joined: Dec 20, 2006
Feb 23, 2011 09:02:56
you have to use nextval to retrieve the unique sequence value.
After that, curval will return the value created by that nextval call.
curval only works after you have called nextval.
OCUP UML fundamental and ITIL foundation
It is sorta covered in the
JavaRanch Style Guide
subject: Using Sequence to populate ID(SOLVED)
java.lang.outOfMemory when rendering large PDF
Porting to MaxDB
Escaping Characters in SQL Queries
inserting a sequence value to the table
hibernate_sequence does exists ERROR
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013