Makasih bgt nih

 

Lebih useful daripada utl_compress ternyata

 

 

  _____  

From: Yulius Wibowo [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 05, 2006 10:24 AM
To: [email protected]
Subject: [indo-oracle] Re: Output PL-SQL ke zip

 

UTL_COMPRESS hanya ada mulai database 10G.

Alternatif lain, anda bisa membuat program menggunakan Java di dalam 
database. Berikut ini contoh program yg saya kutip dari sebuah 
source.

CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "UTLZip" AS
import java.util.zip.*;
import java.io.*;
public class UTLZip
{
public static void compressFile(String infilename, String 
outfilename)
{
try
{
FileOutputStream fout = new FileOutputStream(outfilename);
ZipOutputStream zout = new ZipOutputStream(fout);
ZipEntry ze = new ZipEntry((new File(infilename)).getName());
try 
{
FileInputStream fin = new FileInputStream(infilename);
zout.putNextEntry(ze);
copy(fin, zout);
zout.closeEntry();
fin.close();
}
catch (IOException ie)
{
System.out.println("IO Exception occurred: " + ie);
}
zout.close();
}
catch(Exception e)
{
System.out.println("Exception occurred: " + e);
}
}

public static void copy(InputStream in, OutputStream out) 
throws IOException
{ 
byte[] buffer = new byte[4096];
while (true) {
int bytesRead = in.read(buffer);
if (bytesRead == -1) break;
out.write(buffer, 0, bytesRead);
}
} 
}
/

CREATE OR REPLACE PACKAGE UTLZip
IS
PROCEDURE compressFile (p_in_file IN VARCHAR2, p_out_file IN 
VARCHAR2)
AS
LANGUAGE JAVA
NAME 'UTLZip.compressFile(java.lang.String, 
java.lang.String)';
END;
/

Contoh penggunaannya:

SQL> exec UTLZip.compressFile 
('/home/oracle/test.txt','/home/oracle/test.zip')

Bowo

--- In indo-oracle@ <mailto:indo-oracle%40yahoogroups.com> yahoogroups.com,
"Yulius Wibowo" 
<[EMAIL PROTECTED]> wrote:
>
> Pakai UTL_COMPRESS
> 
> Bowo
> 
> --- In indo-oracle@ <mailto:indo-oracle%40yahoogroups.com>
yahoogroups.com, Rahandra Pramono <RPramono@> 
> wrote:
> >
> > Dear all,
> > 
> > 
> > 
> > Ada yang tau gak gimana melakukan kompresi langsung untuk output 
> dari
> > pl-sql?
> > 
> > Package yang dipakai apa ya?
> > 
> > Atau Cuma ada satu cara dengan menggunakan kompresi dari system?
> > 
> > 
> > 
> > Mohon pencerahannya ya
> > 
> > 
> > 
> > Terima kasih
> > 
> > 
> > 
> > 
> > 
> > [Non-text portions of this message have been removed]
> >
>

 



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/PhFolB/TM
--------------------------------------------------------------------~-> 

--
-----------I.N.D.O - O.R.A.C.L.E---------------
Keluar: [EMAIL PROTECTED]
Website: http://indo-oracle.blogspot.com
Mirror: http://indooracle.wordpress.com
-----------------------------------------------

Bergabung dengan Indonesia Thin Client User Groups, 
Terminal Server, Citrix, New Moon Caneveral, di:
http://indo-thin.blogspot.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/indo-oracle/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Kirim email ke