So erstellen Sie einen ZIP-Ordner in plsql (Oracle)

Ich erstelle eine Datei in einem Verzeichnis, das ich spezifiziere. Ich möchte für jeden Lauf einen anderen Ordnernamen in einem Verzeichnis mit unterschiedlichem Dateinamen anlegen. Und dieser Ordner sollte gezippt werden.

Zurzeit benutze ich:

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;

Dieser Code verschiebt das Blob-Bild in einen Ordner in einem Verzeichnis. Ich möchte, dass dieses Blob-Bild in einem separaten Ordner erstellt wird, der sich unter einem gezippten Ordner befindet.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage