当前位置: 代码迷 >> Oracle技术 >> 关于create directory的有关问题
  详细解决方案

关于create directory的有关问题

热度:137   发布时间:2016-04-24 08:35:46.0
关于create directory的问题
create directory testdir as '/testdir';


我想知道上边的定义,最终映射到了那个物理目录下边?


如果在另一台机器上向ORACLE中存放BFILE,应该怎么写?

先答分多。

------解决方案--------------------
我一般是写绝对路径的

给你个例子吧,我改了一下去掉了敏感信息

SQL code
declare  a_bfile BFILE;  a_blob BLOB;begin  insert into xxxx (DOC_CONTENT )  values (EMPTY_BLOB())  returning DOC_CONTENT into a_blob;  a_bfile := BFILENAME('MY_DIR','1.1.xml');  dbms_lob.fileopen(a_bfile);  dbms_lob.open(a_blob, dbms_lob.lob_readwrite);  dbms_lob.loadfromfile(a_blob, a_bfile, dbms_lob.getlength(a_bfile));  dbms_lob.close(a_blob);  dbms_lob.fileclose(a_bfile);  commit;end;
------解决方案--------------------
实测结果:


从图中可见,Oracle是不会检测你指定的目录是否是存在的。
文档中要求是全路径名,即指定的路径名一定得是一个在你的文件系统中真实存在的全路径名,
否则在创建的时候没问题,但一使用就出错了。

所以这时没有什么相对路径的概念。
  相关解决方案