title: Creating an Oracle User if it doesn't already exist
body: <p>I am trying to create a script that will create users <strong>if they do not already exist</strong>.</p>
  
  <pre><code>CREATE USER "Kyle" PROFILE "DEFAULT" IDENTIFIED BY "password" ACCOUNT UNLOCK
  WHERE NOT IN  //Also tried 'WHERE NOT EXISTS'
  (
      SELECT username FROM all_users WHERE username = 'Kyle'
  )
  </code></pre>
  
  <p>The following error is given:</p>
  
  <blockquote>
    <p>SQL Error: ORA-00922: missing or invalid option</p>
  </blockquote>
  
  <p>I was able to do this in SQL Server 2008 by using:</p>
  
  <pre><code>IF NOT EXISTS
  (SELECT name FROM master.sys.server_principals
  WHERE name = 'Kyle')
  BEGIN
      CREATE LOGIN Kyle WITH PASSWORD = 'temppassword' MUST_CHANGE, CHECK_EXPIRATION=ON, CHECK_POLICY=ON
  END
  </code></pre>
  
  <p>Is there a similar way in Oracle to check if a user already exists before attempting to create a new user?</p>