Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

find the next id in database

843859Apr 11 2006 — edited Apr 11 2006
Hi I am creating a simple table like this (and dropping/creating schema before hand so my tests work correctly):

drop schema books cascade;
create schema books;
create sequence books.entity_id_sequence;
create table books.book(id bigint DEFAULT nextval('books.entity_id_sequence') primary key,
title varchar(256));

However when I use "executeUpdate" in my code like this -

int m = executeUpdate("INSERT INTO books.book VALUES(0,'Some books title')");

I don't know how to specify the next available id value I have just stuck a zero in there. How do you find the next available id value from the database?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 9 2006
Added on Apr 11 2006
4 comments
125 views