Record Exists function template


/ Published in: PL/SQL
Save to your folder(s)

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?


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.