SQL> SQL> SQL> CREATE OR REPLACE FUNCTION qstring (str_in IN VARCHAR2, qchar_in VARCHAR2 := '|') 2 RETURN VARCHAR2 3 IS 4 retval VARCHAR2(32767); 5 BEGIN 6 EXECUTE IMMEDIATE 7 'BEGIN :var := q''' || qchar_in || str_in || qchar_in || '''; END;' 8 USING OUT retval; 9 RETURN retval; 10 END; 11 / Function created. SQL> SQL> SQL>