title: Oracle null and unique constraint
body: <p>Does a unique constraint include a not null constraint?</p>
  
  <p>I have a case that one attribute <code>cellPhone</code> can be <code>NULL</code> but cannot be repeated, so I give it 2 constraints: "not null" and "unique", in a case of updating the record, if user didn't enter a value I put 0 in the field, so it makes this exception:</p>
  
  <pre><code> SEVERE: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (TEST1.OSQS_PARENTS_CELLPHONE_UK) violated
  </code></pre>
  
  <p>What should I do in the <code>UPDATE</code> case?</p>
  
  <p><strong>EDIT</strong>
  here's the definition of table ddl </p>
  
  <pre><code>CREATE TABLE "TEST1"."OSQS_PARENTS" 
  (   "PARENT_NO" NUMBER(38,0), 
  "PARENT_NAME" VARCHAR2(4000 BYTE), 
  "PARENT_ID" NUMBER(38,0), 
  "PARENT_EMAIL" VARCHAR2(30 BYTE), 
  "PARENT_CELLPHONE" NUMBER(38,0)
  )
  </code></pre>
  
  <p>and here's an image of the constraints
  <img src="https://i.stack.imgur.com/RXhHN.png" alt="enter image description here"></p>
  
  <p>and here is the update statement</p>
  
  <pre><code>    Parent aParent;      //is an object I pass through a function
  String SQlUpdate = "UPDATE OSQS_PARENTS P SET P.PARENT_ID=?,P.PARENT_EMAIL=?,P.PARENT_CELLPHONE=?"
              + " where P.PARENT_NO=?";
      PreparedStatement pstmt = null;
      try {
          pstmt = con.prepareStatement(SQlUpdate);
          pstmt.setLong(1, aParent.getId());
          pstmt.setString(2, aParent.getEmail());
          pstmt.setLong(3, aParent.getCellPhoneNo());
          pstmt.setLong(4, parentNo);
  
          pstmt.executeUpdate();
      }
  </code></pre>