Home » Category » Oracle

Oracle: zipping a file from Oracle Procedure.

400| Thu, 14 Feb 2008 08:09:00 GMT| user558620| 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 & Tags: zipping, file, oracle, procedure.

URL: http://database.itags.org/oracle/291709/
 
«« Prev - Next »» 9 helpful answers below.
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 |

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 |

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

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

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 |

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 |

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 |

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 |

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 |

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 |

Oracle Hot Answers

Oracle New questions

Oracle Related Categories