回答:
1、utl_file是oracle的一个包,用于在pl/sql或中读写操作系统中的文件的。
2、资料你可以参照oracle联机文档的“Oracle8i Supplied PL/SQL Packages Reference”,oracle8i是a76936.pdf这个文件。
3、书你可以参照机械工业出版社的《oracle8i PL/SQL程序设计》,好像是这个书名,特别不错。
1、utl_file是oracle的一个包,用于在pl/sql或中读写操作系统中的文件的。
2、资料你可以参照oracle联机文档的“Oracle8i Supplied PL/SQL Packages Reference”,oracle8i是a76936.pdf这个文件。
3、书你可以参照机械工业出版社的《oracle8i PL/SQL程序设计》,好像是这个书名,特别不错。
1。a76936.pdf是联机文档吗?
2。“机械工业出版社的《oracle8i PL/SQL程序设计》”我在书店里翻过,里面讲到了utl_file吗?
2、《oracle8i PL/SQL程序设计》这本书,我刚刚翻了一次,确实没有找到utl_file的说明.
3、不过你可以在www.google.com这个网站搜oracle utl_file这个串,搜之前把搜中文网页选中,就会搜出好多相关的文章,慢慢看吧。
UTL_FILE
The UTL_FILE package lets your PL/SQL programs read and write operating system (OS) text files. It provides a restricted version of standard OS stream file input/output (I/O). The file I/O capabilities are similar to those of the standard operating system stream file I/O (OPEN, GET, PUT, CLOSE), with some limitations. For example, call the FOPEN function to return a file handle, which you then use in subsequent calls to GET_LINE or PUT to perform stream I/O to a file. When you are done performing I/O on the file, call FCLOSE to complete any output and to free any resources associated with the file. 后边还有一大堆东西,有两页,但介绍的还可以,不妨看看
中国水利水电出版社
作者是自己编写的,不是抄的,很实用有对UTL_FILE很详细的介绍。
/**************************************************************************
name:sp_Write_log
parameter:textContext in varchar2 日志内容
create date:2002-12-19
creater:chen jiping
desc:写日志,把内容记到服务器指定目录下
****************************************************************************/
procedure sp_Write_log(textContext varchar2)
IS
file_handle UTL_FILE.file_type;
Write_content VARCHAR2(1024);
begin
file_handle:=UTL_FILE.FOPEN('\oracle\log','mylog.log','a');
Write_content:=to_char(SYSDATE,'yyyy-mm-dd hh24:mi:ss')||'||'||textContext;
IF UTL_FILE.IS_OPEN(file_handle) THEN
UTL_FILE.PUT_LINE(file_handle,Write_content);
END IF;
UTL_FILE.Fclose(file_handle);
EXCEPTION
WHEN OTHERS THEN
IF UTL_FILE.IS_OPEN(file_handle) THEN
UTL_FILE.Fclose(file_handle);
END IF;
end sp_Write_log;
----------------------
别忘了设置utl_dir参数
如utl_file_dir='/oradb/'
有说明不过,我测试过,速度很慢,如果有比较大的文件I/O,最好不用
[email protected]
对包中每一个函数都作了讲解