Below function checks if a grade exists  ----------------------------------------------------------------------------  -- CHECK IF THE VALUES WE PASSED AS PARAMETERS EXISTS AS A ONE ROW RECORD IN THE TABLE  ----------------------------------------------------------------------------  function record#exists(    i_math_grade              pls_integer   ,i_science_grade           pls_integer   ,i_english_grade           pls_integer   ,i_music_grade             pls_integer   ,i_average                 pls_integer     )  return boolean  is    l_cnt                     pls_integer;  begin    begin      select count(*)      into   l_cnt      from   grade      where  math_grade    = i_math_grade        and  science_grade = i_science_grade        and  english_grade = i_english_grade        and  music_grade   = i_music_grade        and  average       = i_average;    exception      when no_data_found then        return false;    end;    return l_cnt > 1;  exception    when others then      raise_fa_err('record#exists');  end record#exists; 
Checking whether a grade combination exists
sql;oracle;plsql
This is very much the same idea I'm using to encapsulate business logic queries for re-use in PL/SQL code. So if you're looking for a validation of a concept you'll pass my review :) In a comment to the other answer you said this is just a snippet from a package code - that's good you're using packages. For PL/SQL apps in practice all code should be located in a package - a standalone subprograms a rare.The notes:select count is always guaranteed to return a single number so the exception handler for no_data_found is a dead code and should be removed.If you're just checking for existence there's no point to count beyond 1, thus enter rownum = 1. This also guarantees the select returns either 0 or 1. This might or might not help your query performance (check explain plan).It's a bit questionable if such an utility subprogram should record the exception or not but more information about your error handling implementation would be required to comment further. I usually don't but I'll let the exception propagate to the caller context and then record the full stack trace there. The good thing is that you re-raise (I just assume that from the name of raise_fa_err). Modified example with the points #1 and #2 applied:function record#exists(  i_math_grade    in pls_integer ,i_science_grade in pls_integer ,i_english_grade in pls_integer ,i_music_grade   in pls_integer ,i_average       in pls_integer) return boolean is  l_exists pls_integer;begin  select count(*)  into   l_exists  from   grade  where math_grade    = i_math_grade    and science_grade = i_science_grade    and english_grade = i_english_grade    and music_grade   = i_music_grade    and average       = i_average    and rownum        = 1  ;  return l_exists = 1;exception  when others then    raise_fa_err('record#exists');end record#exists;