title: Oracle Unique Constraint - Mixed Case
body: <p>I have an Oracle table that has the following columns:</p>
  
  <pre><code>ID
  FUNCTION_ID
  FUNCTION_ROLE
  </code></pre>
  
  <p>The ID column is unique (sequence) but I also want both (FUNCTION_ID, FUNCTION_ROLE) combination to also be unique.</p>
  
  <p>My query is though, as the FUNCTION_ROLE is a string and the value can be mixed case, what is the best approach to prevent this from happening, i.e.:</p>
  
  <pre><code>Data for this table:
  Row 1: 1,1,TEST1
  Row 2: 2,1,Test1
  </code></pre>
  
  <p>I would expect to get a unique constraint violation when trying to insert Row 2 as ‘Test1’ is the same as ‘TEST1’ – just the case is different.</p>
  
  <p>How can I prevent this as one approach I was thinking was creating another column called FUNCTION_ROLE_UPPER and using this column along with FUNCTION_ID to check for uniqueness – would this be the correct approach?</p>