Sunday 14 October 2012

APEX Reporting on Comment Columns

This function may help you if you need to report on columns with a lot of text. It will get rid of the carriage return and will help not to break your reports imported into Excel:

CREATE OR REPLACE FUNCTION x_rep (p_string IN VARCHAR2)
   RETURN VARCHAR2
IS
   v_string   VARCHAR2 (4000);
BEGIN
   v_string :=
      REPLACE (TRANSLATE (p_string, 'x' || CHR (10) || CHR (13), 'x'),
               ';',
               '/'
              );
   RETURN v_string;
EXCEPTION
   WHEN OTHERS
   THEN
      RETURN NULL;
END x_rep;
/


No comments: