Need to query the database to get the last sequence number
723460Sep 19 2009 — edited Sep 19 2009Hi all
I am trying to get the last sequence number of the last row inserted into my Oracle database. Please could someone give me the SQL which would allow me to do this - using Oracle SQL Explorer I have confirmed that there is a sequence on the table which is called: XYZ_SEQ and the code for this is:
CREATE SEQUENCE "MY_USER_NAME"."XYZ_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 21 CACHE 20 NOORDER NOCYCLE ;
My Java application is inserting a row into my table and to insert a new row I need to have the last sequence inserted +1 so the new row can be added.
Any help would be much appreciated.