title: oracle - how to use sequence as auto increment id?
body: <p>I have an oracle database table:</p>
  
  <pre><code>CREATE TABLE "DogInfo" (
  "Id" NUMBER NOT NULL ENABLE,
  "DogName" VARCHAR2 (50 CHAR) NOT NULL ENABLE,
  "DogAge" NUMBER NOT NULL ENABLE,
  CONSTRAINT "DogInfo_PK" PRIMARY KEY ("Id") ENABLE
  );
  
  CREATE SEQUENCE "DOGINFO_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE;
  
  CREATE OR REPLACE TRIGGER  "BI_DogInfo" 
  BEFORE INSERT ON "DogInfo" FOR EACH ROW
  WHEN (NEW."Id" IS NULL OR NEW."Id" = 0) BEGIN
      SELECT "USERINFO_SEQ".nextval INTO :NEW."Id" FROM dual;
  END;
  
  ALTER TRIGGER  "BI_DogInfo" ENABLE;
  </code></pre>
  
  <p>If I insert 20 records into the table with database tool, and then use my C# web application to insert records, the dog id will start with 1, rather than 21.</p>
  
  <p>Anyone can help me fix this bug?</p>
  
  <p>Thanks.</p>