21.3 CSV Function Signature 1

This function escapes special characters in a CSV value (VARCHAR2).

Syntax

APEX_ESCAPE.CSV (
    p_string        IN VARCHAR2,
    p_quote         IN BOOLEAN  DEFAULT TRUE,
    p_strip_html    IN BOOLEAN  DEFAULT FALSE )
    RETURN VARCHAR2;

Parameters

Table 21-2 CSV Parameters

Parameter Description
p_string The string to be escaped.
p_quote If TRUE (default) and p_string contains special characters, enclose the result with the p_enclose_by parameter of set_csv_parameters.
p_strip_html

Default FALSE.

If TRUE, remove any HTML tags.

Example

The following example prints a CSV report with employee IDs and names and non-default ; as separator.

BEGIN
   apex_escape.set_csv_parameters (
       p_enclosed_by  => '"',
       p_separated_by => ';' );

   for i in ( select empno, ename from emp ) loop
       sys.dbms_output.put_line (
           i.empno || ';' || apex_escape.csv(i.ename) );
   END loop;
END;