Prashant's Weblog
Random Brain "Droppings" of yet another software engineer







Tuesday, August 01, 2006

Zip a file using PL/SQL

Today was quite interesting day at office. As part of the current project I am working on, today, I had a very strange request from our client. It goes like this;

we have a table, which has a BLOB column that contains a XML file(CONTAINS!!..ok.. Contains/points to a XML file). Now the requirement is, using PL/SQL I need to zip this XML file and then insert the zipped file into another table(BLOB column), after doing so I need to send this zipped XML file to a list of people by e-mail.

At the first glance it seems impossible ..but when you break it up, we have the following three tasks to be done;

1) Zip the XML file
2) Insert the zipped file to another BLOB
3) Attach the BLOB to mail and send it.

Second and third tasks atleast look doable, I was thinking of writing a trigger which will fire after insert and will attach the file and send a mail. The mail part, I am sure I will hijack a mail package from metalink :)

Now the difficult part...Zip a file using PL/SQL!! I am not sure how to do this..I looked for some Oracle package that can do this, but couldn't find one, not sure if one exist. So alternate solution could be to take care of the file compression using java and call those java functions in PL/SQL. SIMBLE isn't it?

yeah, never have I written a single line of Java code, never have called a Java function in PL/SQL and with just 15 days deadline to do it and make it work..Life can't get any better :)

2 Comments:

  • This comment has been removed by a blog administrator.

    By Anonymous Anonymous, at 5:59 PM  

  • Hi

    I have a similar problem. Did you get this resolved by any chance?

    By Anonymous Anonymous, at 6:19 PM  

Post a Comment

<< Home