Updating sequence in oracle

The primary key column was auto populated by a sequence value.How should I get the last inserted records auto generated primary key?PUT_LINE('旧的region_id值是'

We passed two arguments first the insert query string and second an array of column name.The column name should be the primary key column name of table where you inserting the record. We have a database table called CREATE TABLE STUDENTS ( STUDENT_ID NUMBER NOT NULL PRIMARY KEY, NAME VARCHAR2 (50 BYTE), EMAIL VARCHAR2 (50 BYTE), BIRTH_DATE DATE ); CREATE SEQUENCE STUDENT_SEQ START WITH 0 MAXVALUE 9999999999999999999999999999 MINVALUE 0; String QUERY = "INSERT INTO students " " VALUES (student_seq.NEXTVAL," " 'Harry', '[email protected]', '31-July-1980')"; // load oracle driver Name("driver.Prepared Statement prepare Statement = connection.prepare Statement("insert...", new String[] ); prepare Statement.execute Update(); Result Set generated Keys = prepare Generated Keys(); if (null != generated Keys && generated Keys.next()) The above code should give us auto generated primary key value.

Search for updating sequence in oracle:

updating sequence in oracle-4updating sequence in oracle-64updating sequence in oracle-12updating sequence in oracle-19

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “updating sequence in oracle”

  1. You don’t want to miss our chat this month because it isn’t just for pastors… In this conversation Jerry Parries (the pastor at the Christian Family Worship Center), my pastor, Kevin Labby (Willow Creek Presbyterian Church), and I open our hearts to one another about reconciliation, love, grace… It’s a place where one can hear the free and joyful laughter of the redeemed.