【发布时间】:2016-09-15 16:14:03
【问题描述】:
我已经写了一个 pl/sql 程序:
PROCEDURE xx_WriteBLOBToFILE (myfilename IN VARCHAR2,L_PERSON_ID IN NUMBER) IS
v_blob BLOB;
blob_length INTEGER;
out_file utl_file.file_type;
v_buffer RAW(32767);
chunk_size BINARY_INTEGER := 32767;
Blob_Position Integer := 1;
G_Zipped_Blob Blob;
B_Dl_File1 Blob;
BEGIN
-- Retrieve the BLOB for reading
Select Image Into V_Blob From Per_Images
Where Parent_Id =L_PERSON_ID;
-- Retrieve the SIZE of the BLOB
blob_length:=DBMS_LOB.GETLENGTH(v_blob);
-- Open a handle to the location where you are going to write the BLOB to file
-- NOTE: The 'wb' parameter means "write in byte mode" and is only availabe
-- in the UTL_FILE package with Oracle 10g or later
Out_File := Utl_File.Fopen ('**INT_DIR_IMG_BLOB**', Myfilename, 'wb', Chunk_Size);
-- Write the BLOB to file in chunks
WHILE blob_position <= blob_length LOOP
IF blob_position + chunk_size - 1 > blob_length THEN
chunk_size := blob_length - blob_position + 1;
End If;
DBMS_LOB.READ(v_blob, chunk_size, blob_position, v_buffer);
UTL_FILE.PUT_RAW(out_file, v_buffer, TRUE);
blob_position := blob_position + chunk_size;
END LOOP;
-- Close the file handle
Utl_File.Fclose (Out_File);
End;
我想在 /Blobfile 的某个位置动态创建文件夹,然后动态创建类似 INT_DIR_IMG_BLOB 的目录。
如何在 plsql 中创建服务器中的文件夹
【问题讨论】:
标签: plsql oracle-sqldeveloper plsqldeveloper