We have a table with a Primary Key that gets populated on insert by a trigger on the table - the trigger gets the next sequence number from a sequence we created for the table a
I don't know if it works with triggers but the RETURNING clause may be what you're looking for:
INSERT INTO my_table (col_1, col_2)
VALUES ('foo', 'bar')
RETURNING pk_id INTO my_variable;
why not just return the_sequence.currval ?
I think you are looking for a Callable Statement. Here's javadoc if you are trying to get to it from Java.