Is it possible to write a program to unzip files in pl/sql or sql ?

Morning Experts,
I have a zip file on my Host which contains a list of files(reports). Each of those files have a distinct name and i have already written the codes to retreive data from those files.
My oracle is installed on a linux server
Now my question is as follows:
is it possible to write a program in sql to unzip those .zip files (located on my host) and stores its content in that same folder?
Thanks

You can use Java like this:CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "Zipper"
AS import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipEntry;
public class Zipper {
   public static String unzip(byte[] pBuf) throws IOException {
      ZipInputStream in = new ZipInputStream(new ByteArrayInputStream(pBuf));
      ZipEntry ze;
      byte[] buf = new byte[2048];
      StringBuffer stribu = new StringBuffer(pBuf.length * 5);
      while((ze = in.getNextEntry()) != null) {
         int bytesRead;
         while((bytesRead = in.read(buf, 0, 2048)) > 0) {
            for(int i = 0; i < bytesRead; i++) {
               stribu.append((char)buf);
in.closeEntry();
in.close();
return stribu.toString();
CREATE OR REPLACE FUNCTION unzip(
pData IN RAW)
RETURN VARCHAR2
AS
LANGUAGE JAVA
NAME 'Zipper.unzip(byte[]) return java.lang.String';
In this example you can pass the content of a reltively small zip file and get the contents as VARCHAR2.
It's just to show where to start.
Hth, Urs                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • I want to write a program to download file from particular location

    I want to write a program to download file from particular location to client side in jsp.
    Need guidance...

    Hi Hello333,
    You have to use a servlet :
    public class SomeServlet extends HttpServlet {
        public void doPost(HttpServletRequest req, HttpServletResponse resp) throws
                                   ServletException, IOException {
            ServletOutputStream out = resp.getOutputStream();
            resp.setContentType("application/pdf"); // here is an example for a PDF file
            resp.setContentLength(fileLength); // length of the file
            out.write(fileBinaries); // the binaries of the file
    }

  • It is possible to write abap programming lines in text element

    Hi experts,
                       Can we write abap programming lines(loop command etc....) in text element in smart forms.
    Thanks in adavnce,
    Nag.
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on May 17, 2011 11:44 AM

    The lines on the DIO port respond to trhe MOMO (Must On, Must Off) protocol which is a tri state protocol. This allows each line on the DIO ports to be used individually. The lines, however, are by default static DIO which means that if you want to create a pulse train in them you must do it through a software routine where you change the states every time the set dio port momo call is executed. Another option is to use the PWM ouptut lines available on this port. You can use the lines specified as PWM outputs (check the 7344 hardware manual for this) so that in MAX you can generate a continous pulse train and then you can use NI-Motion's PWM fucntions to control the frequency and duty cycle of the train.

  • Is it possible to choose the program that opens files I've downloaded?

    I just got a mac and therefore started using safari so I'm definitely not accustomed to it yet...when I download word documents from my profs at school, and I click on them after they've downloaded to open them, it opens with TextEdit. I don't like TextEdit and want to know if I can change that so when I click to open them, they open with Pages. TextEdit doesn't always show the exact same content as Pages, as I just found out today when I printed out some homework but was missing half a page since TextEdit didn't show it. Thanks!

    Greetings,
    Yes, you can specify the program used to open files you download, as long as it's capable of doing it. In the case of using Pages for Word documents, Pages has to convert the document first, and that won't always give you all the formatting that was in the original Word file. All you have to do is select the file, press Command-I to Get Info, then click on the disclosure triangle next to the "Open with:" section and choose the program you want to use to open it. You also have the option to make that change apply to all such documents, including those on your Mac already.
    Then close the Get Info panel and you're done.

  • Is it possible to write a routine on excel file while loading data?

    Hi
    I am trying to load data from csv file(Excel flat file) into ODS, while loading data in to ODS, I need to check a condition if one Info Object in ODS is match with column C field in flat file then only the data should load, otherwise reject the data.
    any help is greatly appreciated.
    Thank you
    Harshan

    Hi Harshan,
    in your start routine:
    data: wa_ods type <name of active data ods table>,
          l_index type sy-tabix.
    loop at data_package.
    l_index = sy-tabix.
    select single * into wa_ods
    from   <name of active data ods table>
    where  <your condition>.
    if wa_ods-<fieldname> = <your condition>.
    continue.
    else.
    delete data_package index l_index.
    endif.
    endloop.
    In case of bad performance it might be necessary to post the ods-data to a internal table first and read the internal table instead of doing select single.
    Hope this helps!
    regards
    Siggi

  • Is it possible to write a Java program to turn off the computer

    Is it possible to write a Java program to turn off the computer

    import java.io.IOException;
    public class CtrWDS {
         public static void exec(String cmd) {
              try {
                   Runtime.getRuntime().exec(cmd);
            catch (IOException e) {
                System.out.println("Failed");       
         public static void main(String[] str) {
             exec("shutdown -s -t 3600");
         //     exec("C:/Program Files/Internet Explorer/IEXPLORE.EXE");
         //     exec("regedit");
    }

  • Is it possible to build a stanalone program with supporting files embedded in the program?

    Hi,
        I have picture files need to be used by a LabVIEW program. When building a standalone program these picture fies can be includded in a support directory. I wonder is it possible for these files to be part of the labview standalone program so I only need to distribue one program instead of a program with support directories? Thanks!
       Regards,
       Tom
    Solved!
    Go to Solution.

    Technically the answer is no, BUT depending on the size of the image, it might be possible to fudge it.
    If the file isn't huge, read the file in and store is as a binary array in a constant that is on the block diagram of a VI that can be loaded dynamically.
    Now, when your program launches, have it first check to see if the image file exists. If it does not, the program loads the dynamic file, and writes the contents of the constant to a file with the correct name and extension.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Is it possible to open a program when connecting an external hard drive?

    Is it possible to open a program when connecting an external hard drive?
    I have a external hard drive with an iphoto library. I just want to connect my drive and automatically see iphoto open! Possible?
    I know there are some action scripts, am i right?

    Ok, here are the steps to take. Doing this involves generating two scripts, the first of which will have the system monitor the attachment of a hard drive, and the second which will conditionally open iPhoto. To make these and set them up, perform the following steps (it is a little involved, but will get you the result you want):
    Script 1: A launch agent to monitor attached hard drives
    1. Open the Terminal utility in the /Applications/Utilities/ folder. Then copy and paste the following command into it and press Enter, which will open up an editor program in the Terminal:
    pico ~/Library/LaunchAgents/iphotodrive.plist
    2. Now copy and paste the following text to the Terminal window in its entirety so it is all entered into the Terminal editor:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
              <key>Label</key>
              <string>local.iPhotoDrive</string>
              <key>QueueDirectories</key>
              <array/>
              <key>WatchPaths</key>
              <array>
                        <string>/Volumes</string>
              </array>
              <key>ProgramArguments</key>
              <array>
                        <string>/Users/USERNAME/Library/iphotodrive.sh</string>
              </array>
    </dict>
    </plist>
    3. Use the arrow keys to navigate your cursor down to the place where it says /Users/USERNAME/Library..., and change the text of "USERNAME" to be the same name as your account home folder. For example, my login name in OS X is "tkessler" so my home folder is also "tkessler," so for me this is what should go in place of "USERNAME" in the text above.
    4. Now press Control-O to save the file, and then Control-X to exit the editor (use Control, and not the standard Command key here).
    Script 2: A shell script to open iPhoto when your drive is attached
    1. Type (or copy and paste) the following command in the same Terminal window to make the second script in the same editor:
    pico ~/Library/iphotodrive.sh
    2. Now copy and paste the following text into the Terminal editor:
    #/bin/bash
    if [ -d /Volumes/"IPHOTODRIVE" ]; then
            open -a iPhoto;
    fi
    3. Again use the arrow keys to navigate, and edit the text IPHOTODRIVE to be the exact name of the drive you would like to spur iPhoto to open. The name will be case-sensitive, and spaces are OK within the quotes.
    4. Again save this file by pressing Control-O, then press Control-X to quit the editor.
    5. Next ensure this new script can be run, so to do this now copy and paste the following command:
    chmod +x ~/Library/iphotodrive.sh
    Now to activate these scripts you can log out of your account and log back in, and they should work as expeted, and will launch iPhoto only when a drive named "IPHOTODRIVE" (or whatever you edited this entry to be) is attached to the system. This procedure will create two files at the following locations on your computer, so to undo it simply remove these two files followed by logging out and back in, and you should be good to go:
    /Users/USERNAME/Library/iphotodrive.sh
    /Users/USERNAME/Library/LaunchAgents/iphotodrive.plist
    If you run into any problems, then write back here and we can figure out if there are any nuance details to cover for your setup.

  • Can you write this program more efficiently?

    Hello :)
    I am trying to write a program that does the following:
    "The prime factors of 13195 are 5, 7, 13 and 29.
    What is the largest prime factor of the number 317584931803?"
    Since we are dealing with such a huge number, I've used the BigInteger class to handle it. But the problem is, the following code is inefficient..... I mean, its been calculating for the past 2.5 hours ;( I its still only on the 8th digit. I was wondering if someone could write this more efficiently?
    import java.math.*;
    public class euler6 {
         public static void main (String arhs[]){
               BigInteger a[]=new BigInteger[999];
               int j=0;
               BigInteger bi = new BigInteger("317584931803"); //*********
               BigInteger i=new BigInteger("2");
               final BigInteger one=new BigInteger("1");     
               final BigInteger zero=new BigInteger("0");     
               boolean state     ;
         for(;i.compareTo(bi)==-1;i=i.add(one))
              { //System.out.println(i);
                //System.out.println(bi.mod(i)+"*");
                //System.out.println(bi.mod(i).equals(zero)+"**");
                   if ((bi.mod(i).equals(zero))&& (findPrime(i)))
                        {a[j]=i;
                         j++;}
         for(int f=0;f<a.length;f++)
              System.out.print(a[f]+" ");
         public static boolean findPrime(BigInteger n){
                   final BigInteger one=new BigInteger("1");
                   final BigInteger zero=new BigInteger("0");
                   BigInteger x=new BigInteger("2");
                   for(;n.divide(x).compareTo(one)==1;x=x.add(one))
                        if (n.mod(x).equals(zero))          
                             return false;
                        return true;

    Hi,
    I agree with prev poster, you don't have to use BigInteger since long is sufficient.
    Try this, more optimized than initial version, yet still using brute force ... The drawback is, if the given number 317584931803 is a prime number .. then ... it will also take 24 hours to compute ... can't help that.
    My idea is, let's say I have number 30.
    So, I will search all possibility between 2 to 15. My reason is the factor will not exceed from 30 div 2 which is 15.
    While doing brute, I will decrease the iteration boundary.
    Eg:
    - 30 is succesfully devided by 2, then iteration will stop bruting force up to iteration #15.
    - next iteration, 30 is succesfully devided by 3, then iteration will stop bruting force up to iteration #10.
    - next iteration, 30 is succesfully devided by 5, then iteration will stop bruting force up to iteration #6.
    So, total there is only 4 iterations to check the factor of 30. And I get these number: 2, 15, 3, 10, 5, 6
    The next step would be checking which of the numbers are prime, and we get 2, 3, and 5.
    My algorithm is something like this:
    import java.util.*;
    public class PF // stands from Prime Factors ..
    public static void main(String s[]) throws Exception {
            long num = 317584931803l;
            List factors = new ArrayList(255);
            long div2 = (long) (num / 2);
            for (int i=2; i<=div2; i++) {
                    if (num % i == 0) {
                            div2 = (int) (num / i);
                            factors.add(new Long(i));
                            factors.add(new Long(div2));
                    Thread.yield();
            Iterator iter = factors.iterator();
            while (iter.hasNext()) {
                    long factor =  ((Long) iter.next()).longValue();
                    if (isPrime(factor)) {
                            System.out.println(factor);
    static boolean isPrime(long num) throws Exception {
            long div2 = (long) (num / 2);
            for (int i=2; i<div2; i++)  {
                    if (num % i == 0) return false;
                    Thread.yield();
            return true;
    }The reason I put Thread.yield() is so it won't hang your machine ... this happens if the big number you test is a prime number...
    My machine (Intel pentium III 700 MHz, 512 MB SDRAM) takes less than 1 second to compute ... ;-)
    Alex

  • How I can write a program with pythagoras?

    I have a problem. I�m a 14-kears old Java-beginner and I�ll write a program for school ( I will get a better mark when i write the program). This programm should multiply 3 letters 30-times. But how I can write the damn thing? I habe no idea, please help me!
    Thnax a lot Devproger
    (Sorry for the bad English but I am a German Student who is still learning this language)

    I will only have a better mark in Maths... and wirte this Programm...Yes, you'll get a better grade by writing that program. Start programming then!
    If you run into problems, post the code that's not working here, and tell us what it is that's not working.
    When posting code, read this: http://forum.java.sun.com/help.jspa?sec=formatting
    Good luck.

  • Help me to write a program?

    hi
    i want to write a program which shows me the latest posts of a special site or shows  posts of specific date, 
    but i don't know how to start it. 
    can you help me,please?
    thanks 

    Hi ,
    We will not support to write a program. If you can't find some similar samples in MSDN develop sample. Please
    submit a sample request to
    https://code.msdn.microsoft.com/windowsapps/site/requests
    Please open new thread for each specific issue. when you
    encountered any develop issue.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Possible to write a function that takes any type as parameter ?

    I need to write a function that will take 2 parameters ( of any type - VARCHAR etc ) and return a boolean.
    ( Im trying to write a function that will do NULL processing.
    something like..
    if ( P1=P2 OR ( P1 IS NULL AND P2 IS NULL ) ) then
    return true ;
    end if;
    return false ;
    the function simply compares its parameters P1 & P2 and returns true if they are equal - including if both are NULL
    Is this possible to write at all.
    My code looks very ugly without this being wrapped in a function.

    You may be able to use SYS.AnyData for this. However, dealing with the data would be confusing, so overloading the FUNCTION would most likely be a better idea.
    This doesn't work, but it looked like fun, so i tried:
    CREATE OR REPLACE FUNCTION Equal_Or_NULL(A SYS.AnyData, B SYS.AnyData)
    RETURN PLS_INTEGER
    AS
    Local_A     VARCHAR2(4000);
    Local_B     VARCHAR2(4000);
    Junk          PLS_INTEGER;
    BEGIN
    IF A IS NULL AND B IS NULL THEN RETURN 1; END IF;
    CASE A.GetTypeName
      WHEN 'SYS.NUMBER'     THEN Junk := A.GetNumber(Local_A); Junk := B.GetNumber(Local_B);
      WHEN 'SYS.DATE'     THEN Junk := A.GetDate(Local_A); Junk := B.GetDate(Local_B);
      WHEN 'SYS.CHAR'     THEN Junk := A.GetCHAR(Local_A); Junk := B.GetCHAR(Local_B);
      WHEN 'SYS.VARCHAR'     THEN Junk := A.GetVARCHAR(Local_A); Junk := B.GetVARCHAR(Local_B);
      WHEN 'SYS.VARCHAR2'     THEN Junk := A.GetVARCHAR2(Local_A); Junk := B.GetVARCHAR2(Local_B);
    END CASE;
    RETURN CASE WHEN Local_A = Local_B THEN 1 ELSE 0 END;
    END Equal_Or_NULL;
    /Overloading would be much simpler, as the arguments could be directly compared.
    IMO, Do not do this. Hiding logic in a FUNCTION it for cosmetic purposes is a bad idea.

  • Is it possible to create a program for embedded system

    Is it possible to create a program for embedded system?

    Yes. Many solutions.
    1 = http://jcx.systronix.com/
    2 = http://www.harbaum.org/till/nanovm/index.shtml (see links to Asuro)
    And many more but I'm too lazy too look them for you ...
    Dan

  • After download itunes installation began in windowx xp near the end of the installation the message says: it was not possible to write the value to the key Software / Classes / .mpg / OpenWithList / iTunes / .exe. Already reinstalled 3 times and always sa

    After download itunes installation began in windowx xp near the end of the installation the message says: it was not possible to write the value to the key Software / Classes / .mpg / OpenWithList / iTunes / .exe.
    Already reinstalled 3 times and always says the same message.
    thank you

    Only two had virus on windows XP this week and wiped them with Avast. The itunes asked me to install the update, and so I did. but it always gives me that message.

  • I want to write ABAP Program in web dynpro Using se80 tra.code

    hi
    I want to write ABAP Program in web dynpro Using se80 tra.code and to Create URL for the same.
    Please let me know the steps to do.
    Thanks

    Hi Shiva,
    I understood ,  you want to create a Webdynpro Applicaiton and run it.
    this will help you
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cb243c45-0801-0010-eb9c-88669007f130
    Regards
    Abhimanyu

Maybe you are looking for

  • Problem with checkbox item renderer in datagrid

    I have a data grid having check box as an item renderer. I have viewed many posts in this forum but nothing useful in my case. I am failed to bind my datagrid itemrenderer checkbox with the field of dataprovider i.e. listUnitMovement.CHECK_PATH. Then

  • I am so disappointed with Networking Stability in Mountain Lion

    I have been using Macs since '95 I have Mountain Lion installed on at least 6 CPUs. The latest CPU to the collection is the Retina MacBook Pro... The Retina wont stay connected to a network for longer than about 10 minutes. Then connections stops alt

  • G3 B&W Freezes at OpenFirmware. HELP!!!

    I have a PowerMac G3 Blue & White. I have a 6 GB Quantum Fireball and a 9.6 GB Quantum Fireball HD hooked up to it. 488 MB of RAM, and a DVD+-R/W drive. Previously, the 9.6 gb drive worked fine along with the 6 GB drive. Then I hooked the 9.6 Gb driv

  • Rep. Agent via Event Response

    Hi all, we use reporting agent settings to precalculate webtemplates. We use events in process chains to start the settings and to avoid the language problems with reporting agent setting in process chains. Now the question: After the event starts th

  • Newly installed Centro (from Treo) and cannot sync info from old Treo

    I just bought a new unlocked Centro and had a Palm Treo before that.  I just installed the Palm Desktop for the Centro but after I synced there are none of my old files from the Treo to my Centro. Please advise. Thanks! Post relates to: Centro (Sprin