SQL> SQL> CREATE OR REPLACE FUNCTION grpval ( 2 tab IN VARCHAR2, 3 col IN VARCHAR2, 4 grpfunc IN VARCHAR2, 5 whr IN VARCHAR2 := NULL) 6 RETURN VARCHAR2 7 IS 8 retval VARCHAR2(32767); 9 BEGIN 10 EXECUTE IMMEDIATE 11 'SELECT ' || yourfunction || '(' || col || ') 12 FROM ' || tab || ' WHERE ' || NVL (whr, '1=1') 13 INTO retval; 14 RETURN retval; 15 END; 16 / Function created. SQL> SQL>