SQL>
SQL> CREATE OR REPLACE PROCEDURE put_line
2 (file_in IN UTL_FILE.FILE_TYPE,
3 line_in IN VARCHAR2,
4
5 max_line_size_in IN INTEGER := 1023)
6 IS
7 v_line VARCHAR2(32767);
8 v_linelen CONSTANT INTEGER := LENGTH (line);
9 v_start INTEGER := 1;
10 v_max CONSTANT INTEGER := max_line_size_in - 1;
11 BEGIN
12 LOOP
13 EXIT WHEN v_start > v_linelen OR v_linelen IS NULL;
14 v_line := SUBSTR (line_in, v_start, v_max);
15 IF v_start + v_max < v_linelen
16 THEN
17 v_line := v_line || '-';
18 END IF;
19 UTL_FILE.PUT_LINE (file_in, v_line);
20 v_start := v_start + v_max;
21 END LOOP;
22 END;
23 /
|