title: How can I drop a "not null" constraint in Oracle when I don't know the name of the constraint?
body: <p>I have a database which has a NOT NULL constraint on a field, and I want to remove this constraint.  The complicating factor is that this constraint has a system-defined name, and that constraint's name differs between the production server, integration server, and the various developer databases.  Our current process is to check in change scripts, and an automated task executes the appropriate queries through sqlplus against the target database, so I'd prefer a solution that could just be sent straight into sqlplus.</p>
  
  <p>On my own database, the SQL to drop this would be:</p>
  
  <pre><code>alter table MYTABLE drop constraint SYS_C0044566
  </code></pre>
  
  <p>I can see the constraint when I query the <code>all_constraints</code> view:</p>
  
  <pre><code>select * from all_constraints where table_name = 'MYTABLE'
  </code></pre>
  
  <p>but I am not sure how to work with the <code>SEARCH_CONDITION</code>'s <code>LONG</code> data type or how best to dynamically delete the looked-up constraint even after I know its name.</p>
  
  <p>So, how can I create a change script that can drop this constraint based on what it is, rather than what its name is?</p>
  
  <hr>
  
  <p>EDIT:
  @Allan's answer is a good one, but I am concerned (in my lack of Oracle expertise) that it may not be universally true that any constraint that might have a system-generated name will have associated with it a way to remove the constraint without having to know its name.  Is it true that there will always be a way to avoid having to know a system-named constraint's name when logically dropping that constraint?</p>