title: Multiple insert SQL oracle
body: <p>How do you do multiple insert with SQL in Oracle 12c when you have an identity column?</p>
  
  <pre><code>INSERT ALL
  INTO Table1 (Column2) Values (1)
  INTO Table1 (Column2) Values (2)
  SELECT * FROM dual;
  </code></pre>
  
  <p>where Table1 has column1 as an identity, will set the identity column to have the same value which violates the primary key constraint.</p>
  
  <pre><code>CREATE TABLE Table1 (
    Table1Id NUMBER GENERATED ALWAYS AS IDENTITY,
    column2 VARCHAR2(255),
    column3 NUMBER,
    PRIMARY KEY (Table1Id)
  );
  
  INSERT ALL
    INTO Table1 (column2, column3) VALUES ('a', '1')
    INTO Table1 (column2, column3) VALUES ('b', '2')
  SELECT * FROM dual;
  
  --SQL Error: ORA-00001: unique constraint violated
  </code></pre>
  
  <p>What am I doing wrong with this?</p>