title: Can I have a mutex table in my database (Oracle) with just plain SQL?
body: <p>I would like to have a table in my Oracle database whose rows act as locks.  The table would have one column, a varchar, and my clients (Java processes over JDBC) would run statements to acquire and release locks.</p>
  
  <p>The acquire statement should check existence of a row with a given value and insert if not there.  The statement should somehow signal to the caller whether the row was free or not.</p>
  
  <p>The release statement should release the lock by deleting the row.</p>
  
  <p>The release statement is straightforward, but what should my acquire statement look like?</p>