使用具有足夠權限的用處創建directory
create or replace directory BFILE_DIR as
[oracle@ts
SQL*Plus: Release
Copyright (c)
Connected to:
Oracle
With the Partitioning
JServer Release
SQL> show parameter utl_file_dir ***************
NAME TYPE VALUE
utl_file_dir string
SQL>
SQL> create or replace directory BFILE_DIR as
Directory created
Elapsed:
SQL>
SQL> col DIRECTORY_PATH for a
SQL> select * from dba_directories;
OWNER DIRECTORY_NAME DIRECTORY_PATH
SYS MEDIA_DIR /oracle/product/
SYS LOG_FILE_DIR /oracle/admin/TSMISC
SYS DATA_FILE_DIR /oracle/product/
SYS KU$_STYLESHEET_DIR /oracle/product/
SYS BFILE_DIR /home/oracle/bfiletest
Elapsed:
SQL>
grant read on directory BFILE_DIR to lunar;
SQL> grant read on directory BFILE_DIR to lunar;
Grant succeeded
Elapsed:
SQL>
host ls
SQL> host ls
SQL>
BFILENAME函數的語法如下:BFILENAME(
該函數用以返回一個BFILE文件位置指針
在你在SQL
以下是一個示例:
CREATE DIRECTORY media_dir AS
create table lunar_test (product_id number
INSERT INTO print_media (product_id
VALUES (
參考:Oracle
再例如
SQL> connect lunar/lunar
create table lunar_test (id number
insert into lunar_test values (
SQL> connect lunar/lunar
Connected
SQL> create table lunar_test (id number
Table created
Elapsed:
SQL> insert into lunar_test values (
Elapsed:
SQL> commit;
Commit complete
Elapsed:
SQL>
declare
fhandle utl_file
begin
fhandle := utl_file
utl_file
utl_file
utl_file
end;
/
declare
fhandle utl_file
fp_buffer varchar
begin
fhandle := utl_file
utl_file
dbms_output
utl_file
dbms_output
utl_file
end;
From:http://tw.wingwit.com/Article/program/Oracle/201311/17596.html