Oracle: zipping a file from Oracle Procedure.

  • user558620 / 400 / Wed, 24 Jun 2009 01:55:00 GMT / Comments (9)
  • Hi EveryBody,
    I need to write a Oracle Procdure to zip a file present in UNIX. I am not allowed to use any shell script to do this. Can anyone help me out in this.
    Thanks in Advance,
    Chandra
  • Keywords:

    zipping, file, oracle, procedure.

  • http://database.itags.org/oracle/291709/«« Last Thread - Next Thread »»
    1. Why would anyone use a backend stored procedure to zip an OS file? Can't you use zip or gzip?

      sundarm | Sat, 23 Feb 2008 17:46:00 GMT |

    2. My clinet doesn't allow use of any shell scripts, thats' why i need to write a procedure to achieve this.

      user558620 | Sat, 23 Feb 2008 17:47:00 GMT |

    3. Well then, just tell the client it can't be done.

      3360 | Sat, 23 Feb 2008 17:48:00 GMT |

    4. That's not a shell script command. It's an UNIX command. Are you allowed to use other unix commands ?

      sundarm | Sat, 23 Feb 2008 17:49:00 GMT |

    5. In 10g, you can read and write files using UTL_FILE and zip it using UTL_ZIP. In 8.1.5 and later, you can write a Java stored procedure that would do the same thing using Java's File and zip classes.

      Justin

      justincave | Sat, 23 Feb 2008 17:50:00 GMT |

    6. Justin, Did you mean UTL_COMPRESS?

      For OP,
      The following thread has an example on creating a compressed file, but it won't be a valid zip file. Check out solution of michaels.
      http://forums.oracle.com/forums/thread.jspa?messageID=1767450&#1767450

      Message was edited by:
      Sundar M

      sundarm | Sat, 23 Feb 2008 17:51:00 GMT |

    7. Yes, I did. Glad someone is paying attention.

      I recently had to do this with a Java stored procedure, and UTL_ZIP was the PL/SQL wrapper I put around its methods. Oops.

      Justin

      justincave | Sat, 23 Feb 2008 17:52:00 GMT |

    8. Justin,

      Sorry i went for lunch. that's why i couldn't respond quickly. Could you please me the examples if you have any.

      Thanks,
      Cahndra

      user558620 | Sat, 23 Feb 2008 17:53:00 GMT |

    9. I believe Sundar provided a link to an example using UTL_COMPRESS and UTL_FILE.

      Justin

      justincave | Sat, 23 Feb 2008 17:54:00 GMT |