如何在plsql中创建zip文件夹(Oracle) [英] How to create zip folder in plsql (Oracle)

查看:322
本文介绍了如何在plsql中创建zip文件夹(Oracle)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在指定的目录中创建文件.我想为每次运行在具有不同文件名的目录中创建不同的文件夹名. 并且该文件夹应该被压缩.

I am creating a file in a directory which i am specifying. I want for each run a different folder name is created in a directory with different file name. And this folder should be zipped.

当前我正在使用:

create or replace
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;

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 ('INTF_DIR1', 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;

这段代码将Blob图片移动到目录中的文件夹中.我希望将此Blob图像生成在单独的文件夹中,该文件夹将位于压缩文件夹下

This piece of code is moving the blob image to a folder in a directory. i want this blob image to be generated in a seperate folder which will be under a zipped folder

推荐答案

请参阅指向 az_zip 使用Oracle存储过程进行压缩

https://technology.amis.nl/wp -content/uploads/2010/06/as_zip10.txt

这篇关于如何在plsql中创建zip文件夹(Oracle)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆