简体   繁体   English

如何直接从我的电脑中的目录获取oracle g11中文件(BFILE)的大小?

[英]How do I get the size of a file(BFILE) in oracle g11 directly from a directory in my pc?

I was trying to get the size of a file from my desktop in Oracle SQL Developer, I'm working with a "BFILE" field. 我试图在Oracle SQL Developer中从我的桌面获取文件的大小,我正在使用“BFILE”字段。

在此输入图像描述

And this is the query that I'm using 这是我正在使用的查询

SET SERVEROUTPUT ON
DECLARE
  v_bfile BFILE;
begin
  select valor into v_bfile from TABLA_BFILE where id = 4;
  DBMS_OUTPUT.PUT_LINE('El archivo ocupa: '||DBMS_LOB.GETLENGTH(v_bfile)||' bytes.');
end;

And I'm getting the next error 而且我得到了下一个错误

ORA-06512: en "SYS.DBMS_LOB", línea 787
ORA-06512: en línea 5
22285. 00000 -  "non-existent directory or file for %s operation"

What I'm missing here? 我在这里缺少什么?

Your code works fine. 你的代码运行正常。
The issue was with the population of the table. 问题出在桌子的人口中。
The directory should not be a path but a DIRECTORY object. 该目录不应该是路径而是DIRECTORY对象。

create directory DESKTOP as 'C:\Users\Roberto\Desktop';
Insert into TABLA_BFILE (ID,valor) values (1,BFILENAME('DESKTOP','oracle.jpg'));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM