Posted By

geekzspot on 10/30/12


Tagged


Versions (?)

"If Exists" PL/SQL Function


 / Published in: PL/SQL
 

Boolean "if exists" Function

  1. FUNCTION email_exists(email_in IN employees.email%TYPE) RETURN BOOLEAN IS
  2. counter INTEGER;
  3. INTO counter
  4. FROM employees
  5. WHERE email = email_in
  6. AND ROWNUM <= 1; -- If exists at least one (1)
  7.  
  8. RETURN ( counter > 0 ); -- Will return boolean True or False
  9.  
  10. END email_exists;

Report this snippet  

You need to login to post a comment.