title: Oracle sequences: CURRVAL not allowed here?
body: <p>The following Oracle SQL code generates the error "<strong><em>ORA-02287: sequence number not allowed here</em></strong>":</p>
  
  <pre><code>INSERT INTO Customer (CustomerID,Name) VALUES (Customer_Seq.nextval,'AAA');
  SELECT * FROM Customer where CustomerID=Customer_Seq.currval;
  </code></pre>
  
  <p>The error occurs on the second line (SELECT statement). I don't really understand the problem, because this does work:</p>
  
  <pre><code>INSERT INTO Customer (CustomerID,Name) VALUES (Customer_Seq.nextval,'AAA');
  SELECT Customer_Seq.currval from dual;
  </code></pre>