- A GL balance extract
- An extract of the account segment values and descriptions
- An extract of the hierarchies for the various account segments.
v_file_line := csvize(t_stringlist('Contents of Field 1','Contents of "Field 2"',etc...));
You can specify as many fields as you like and the function deals appropriately with strings containing the quote character (by double quoting them - which seems to be pretty standard).
TYPE t_stringlist IS TABLE OF VARCHAR2(256);
-- Format a list of strings as CSV
----------------------------------
function csvize(p_stringlist t_stringlist) return varchar2 is
deliminator constant char(1) := '"';
separator constant char(1) := ',';
line VARCHAR2(1000);
begin
FOR i IN p_stringlist.FIRST .. p_stringlist.LAST LOOP
line := line || deliminator || REPLACE(p_stringlist(i),deliminator, deliminator || deliminator) || deliminator;
IF i != p_stringlist.LAST THEN
line := line || separator;
END IF;
END LOOP;
RETURN line;
end;
If you find it useful, let me know!
0 comments:
Post a Comment