-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsvn_file.pkb
76 lines (62 loc) · 2.23 KB
/
svn_file.pkb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
CREATE OR REPLACE PACKAGE BODY "ORASVN"."SVN_FILE" is
/*
This file is part of OraSVN: https://sourceforge.net/projects/orasvn/
OraSVN is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OraSVN is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
procedure utl_file_write (
i_path in varchar2
,i_filename in varchar2
,i_clob in clob
)
is
l_output_file utl_file.file_type;
begin
l_output_file := utl_file.fopen (upper(i_path), i_filename, 'W');
clob_cursor.init(i_clob);
while clob_cursor.has_next loop
utl_file.put_line (l_output_file, clob_cursor.fetch_line);
end loop;
utl_file.fclose(l_output_file);
exception when others then
utl_file.fclose(l_output_file);
raise_application_error(-20001, i_path || ':' || i_filename || chr(10) ||
'backtrace: '|| DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
end;
function utl_file_read (
i_path in varchar2
,i_filename in varchar2
) return clob
is
l_input_file utl_file.file_type;
l_input_buffer varchar2(4000);
l_result clob;
l_exit boolean := false;
begin
l_input_file := utl_file.fopen (i_path,i_filename, 'R');
loop
exit when l_exit;
begin
utl_file.get_line (l_input_file, l_input_buffer);
l_result := l_result || rtrim(l_input_buffer, chr(10)||chr(13)) || chr(10);
exception when no_data_found then
l_exit := true;
end;
end loop;
utl_file.fclose(l_input_file);
return l_result;
exception when others then
utl_file.fclose(l_input_file);
raise_application_error(-20001, i_filename || chr(10) ||
'backtrace: '|| DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
end;
end;
/