title: How do I raise the DUP_VAL_ON_INDEX when user attempts to enter duplicate ID
body: <p>Yes, I ask numerous questions because I learn more here than from the books. I've created a simple code block that produces desired output but it seems to simple for the current learning block i'm in. Would this code work for anyone that attempts to update the iddonor for a donor table if the id already exists? Haven't learned procedures or functions yet but can guess that would be a more sensible method. Does what i have thus far satisfy and exception handler if a condition arises or should I add more in the declaration? Appreciate the suggestions and learning points if provided.</p>
  
  <p>My Code:</p>
  
  <pre><code>BEGIN
     INSERT INTO dd_donor (iddonor)
     VALUES (305)
  
  EXCEPTION
      WHEN DUP_VAL_ON_INDEX THEN
      DBMS_OUTPUT.PUT_LINE('ID already Exists');
  END;
  </code></pre>