user defined functions and EXISTS