Posted By

stews on 09/17/08


Tagged

table exist


Versions (?)

Record Exists function template


 / Published in: PL/SQL
 

I often need to know if a record exists in a table. This method is probably the most efficient. Too many people don't use the exceptions that Oracle provides, which is a shame.

I think I got it from Tom Kyte's site? Or Steven Feuerstein?

  1. CREATE OR REPLACE FUNCTION person_exists(person_id IN VARCHAR2) RETURN BOOLEAN IS
  2. l_count PLS_INTEGER;
  3. INTO l_count
  4. FROM people
  5. WHERE = person_id;
  6.  
  7. END person_exists;

Report this snippet  

You need to login to post a comment.