title: Generate 8 digit random number in oracle, and the number should be unique
body: <p>I have written query to generate a random 8 digit nummber and then i am inserting values into a table. The numbers generated should be unique.</p>
  
  <p>Example: Say below is query, this generates random 8 digit number, and then i am inserting it into table temp. Now everytime before inserting into the table how do i need to check if the number generated from below query is alredy in temp table?</p>
  
  <p>Using for loop doesnt seem to be useful as it will cause lag when there are going to be lot of transactions at same time. Any other suggestions like goto, if number is already in table can we use goto and then redirect it to same query until we get a unique value?</p>
  
  <p>Query: </p>
  
  <pre><code>select trunc(dbms_random.value(10000000,99999999)) 
  into v_customer_nbr  
  from dual;
  </code></pre>