Yes, write a PL/SQL function.