I'm currently writing code that inserts new values into a relation that has an auto-generated ID.
create table person (
person_id number(5) generated always as identity
minvalue 1
maxvalue 99999
increment by 1 start with 1
cycle
cache 10,
firstname varchar(10) not null,
lastname varchar(10) not null,
);
Then, I'm trying to insert a tuple within Java with JDBC:
Statement s;
String query = "insert into PERSON (firstname, lastname) values (\'" + firstname + "\'" + ", " + "\'"
+ lastname + "\')";
s.executeUpdate(query);
This all works fine, but I need to get the generated ID back into my Java program so that I can work with it. Is there any way to do this well?
Thanks!