标签:
utl_file
给用户文件操作权限
1 -----rlwrap sqlplus sys/111111@localhost:1522/xe as sysdba
2 -----以sysdba 身份登陆
3 CREATE OR REPLACE DIRECTORY test_dir as ‘/sandbox/plsql_test‘;
4 -----创建文件夹
5 -----the /sandbox/plsql_test need command $chmod 777 /sandbox/plsql_test
6 -----给写入权限(linux 系统)
7 grant read,write on directory test_dir to &username;
8 GRANT EXECUTE ON utl_file TO &username;
9 ---给oracle 用户文件操作权限
10 select * from ALL_DIRECTORIES;
11 ----查看oralce所有文件夹
12
13 ------测试----------
14 declare
15 f utl_file.file_type;
16 begin
17 f := utl_file.fopen( ‘TEST_DIR‘, ‘testfile.txt‘, ‘w‘); -- w is the write mode
18 utl_file.put_line(f, ‘hello world‘);
19 utl_file.put(f, ‘ ! ‘ );
20 utl_file.fclose(f);
21 end;
22 /
23 show errors;
PLSQL NOTE--------utl_file 的使用
标签:
原文地址:http://www.cnblogs.com/ct-blog/p/5031066.html