Q
Problem solve Get help with specific problems with your technologies, process and projects.

Using SEQUENCE in a Java servlet

How do I use SEQUENCE for a column when I am issuing an INSERT command? I am using the command in a JAVA servlet.

With each sequence, there is a psuedo-column called NEXTVAL. This gets the sequence's next value. Assume I have a sequence called MY_SEQ. Then to insert a value into a table, I might use a statement like this:

INSERT INTO my_table VALUES (my_seq.NEXTVAL, 'bob');
When Oracle sees "my_seq.NEXTVAL" it gets the next value from the sequence and automatically updates the sequence counter for the next transaction.

For More Information


Dig Deeper on Oracle database design and architecture

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close