Unzip a folder using pl/sql

Hi All,
I am creating zip folder using oracle pl/sql. Now i want to unzip the same folder for taking out the compressed file.
Is it possible to unzip the folder in oracle pl/sql.
Thanks in Advance.
Cheers,
Shan

Here's the code
Anton
CREATE OR REPLACE package as_zip
is
  type file_list is table of clob;
  function get_file_list(
    p_dir in varchar2
  , p_zip_file in varchar2
  , p_encoding in varchar2 := null
    return file_list;
  function get_file_list(
    p_zipped_blob in blob
  , p_encoding in varchar2 := null /* Use CP850 for zip files created with a German Winzip to see umlauts, etc */
    return file_list;
  function get_file(
    p_dir in varchar2
  , p_zip_file in varchar2
  , p_file_name in varchar2
  , p_encoding in varchar2 := null
    return blob;
  function get_file(
    p_zipped_blob in blob
  , p_file_name in varchar2
  , p_encoding in varchar2 := null
    return blob;
  procedure add1file(
    p_zipped_blob in out blob
  , p_name in varchar2
  , p_content in blob
  procedure finish_zip(
    p_zipped_blob in out blob
  procedure save_zip(
    p_zipped_blob in blob
  , p_dir in varchar2 := 'MY_DIR'
  , p_filename in varchar2 := 'my.zip'
declare
  g_zipped_blob blob;
begin
  as_zip.add1file( g_zipped_blob, 'test1.txt', utl_raw.cast_to_raw( 'Dit is de laatste test! Waarom wordt dit dan niet gecomprimeerd?' ) );
  as_zip.add1file( g_zipped_blob, 'test1234.txt', utl_raw.cast_to_raw( 'En hier staat wat anders' ) );
  as_zip.finish_zip( g_zipped_blob );
  as_zip.save_zip( g_zipped_blob, 'MY_DIR', 'my.zip' );
end;
declare
  t_dir varchar2(100) := 'MY_DIR';
  t_zip varchar2(100) := 'my.zip';
  zip_files as_zip.file_list;
begin
  zip_files  := as_zip.get_file_list( t_dir, t_zip );
  for i in zip_files.first() .. zip_files.last
  loop
    dbms_output.put_line( zip_files( i ) );
    dbms_output.put_line( utl_raw.cast_to_varchar2( as_zip.get_file( t_dir, t_zip, zip_files( i ) ) ) );
  end loop;
end;
end;
CREATE OR REPLACE package body as_zip
is
  function raw2num(
    p_value in raw
    return number
  is
  begin                                               -- note: FFFFFFFF => -1
    return utl_raw.cast_to_binary_integer( p_value
                                         , utl_raw.little_endian
  end;
  function file2blob(
    p_dir in varchar2
  , p_file_name in varchar2
    return blob
  is
    file_lob bfile;
    file_blob blob;
  begin
    file_lob := bfilename( p_dir
                         , p_file_name
    dbms_lob.open( file_lob
                 , dbms_lob.file_readonly
    dbms_lob.createtemporary( file_blob
                            , true
    dbms_lob.loadfromfile( file_blob
                         , file_lob
                         , dbms_lob.lobmaxsize
    dbms_lob.close( file_lob );
    return file_blob;
  exception
    when others
    then
      if dbms_lob.isopen( file_lob ) = 1
      then
        dbms_lob.close( file_lob );
      end if;
      if dbms_lob.istemporary( file_blob ) = 1
      then
        dbms_lob.freetemporary( file_blob );
      end if;
      raise;
  end;
  function raw2varchar2(
    p_raw in raw
  , p_encoding in varchar2
    return varchar2
  is
  begin
    return nvl
            ( utl_i18n.raw_to_char( p_raw
                                  , p_encoding
            , utl_i18n.raw_to_char
                            ( p_raw
                            , utl_i18n.map_charset( p_encoding
                                                  , utl_i18n.generic_context
                                                  , utl_i18n.iana_to_oracle
  end;
  function get_file_list(
    p_dir in varchar2
  , p_zip_file in varchar2
  , p_encoding in varchar2 := null
    return file_list
  is
  begin
    return get_file_list( file2blob( p_dir
                                   , p_zip_file
                        , p_encoding
  end;
  function get_file_list(
    p_zipped_blob in blob
  , p_encoding in varchar2 := null
    return file_list
  is
    t_ind integer;
    t_hd_ind integer;
    t_rv file_list;
  begin
    t_ind := dbms_lob.getlength( p_zipped_blob ) - 21;
    loop
      exit when dbms_lob.substr( p_zipped_blob
                               , 4
                               , t_ind
                               ) = hextoraw( '504B0506' )
            or t_ind < 1;
      t_ind := t_ind - 1;
    end loop;
    if t_ind <= 0
    then
      return null;
    end if;
    t_hd_ind := raw2num( dbms_lob.substr( p_zipped_blob
                                        , 4
                                        , t_ind + 16
                                        ) ) + 1;
    t_rv := file_list( );
    t_rv.extend( raw2num( dbms_lob.substr( p_zipped_blob
                                         , 2
                                         , t_ind + 10
    for i in 1 .. raw2num( dbms_lob.substr( p_zipped_blob
                                          , 2
                                          , t_ind + 8
    loop
      t_rv( i ) :=
        raw2varchar2
             ( dbms_lob.substr( p_zipped_blob
                              , raw2num( dbms_lob.substr( p_zipped_blob
                                                        , 2
                                                        , t_hd_ind + 28
                              , t_hd_ind + 46
             , p_encoding
      t_hd_ind :=
          t_hd_ind
        + 46
        + raw2num( dbms_lob.substr( p_zipped_blob
                                  , 2
                                  , t_hd_ind + 28
        + raw2num( dbms_lob.substr( p_zipped_blob
                                  , 2
                                  , t_hd_ind + 30
        + raw2num( dbms_lob.substr( p_zipped_blob
                                  , 2
                                  , t_hd_ind + 32
    end loop;
    return t_rv;
  end;
  function get_file(
    p_dir in varchar2
  , p_zip_file in varchar2
  , p_file_name in varchar2
  , p_encoding in varchar2 := null
    return blob
  is
  begin
    return get_file( file2blob( p_dir
                              , p_zip_file
                   , p_file_name
                   , p_encoding
  end;
  function get_file(
    p_zipped_blob in blob
  , p_file_name in varchar2
  , p_encoding in varchar2 := null
    return blob
  is
    t_tmp blob;
    t_ind integer;
    t_hd_ind integer;
    t_fl_ind integer;
  begin
    t_ind := dbms_lob.getlength( p_zipped_blob ) - 21;
    loop
      exit when dbms_lob.substr( p_zipped_blob
                               , 4
                               , t_ind
                               ) = hextoraw( '504B0506' )
            or t_ind < 1;
      t_ind := t_ind - 1;
    end loop;
    if t_ind <= 0
    then
      return null;
    end if;
    t_hd_ind := raw2num( dbms_lob.substr( p_zipped_blob
                                        , 4
                                        , t_ind + 16
                                        ) ) + 1;
    for i in 1 .. raw2num( dbms_lob.substr( p_zipped_blob
                                          , 2
                                          , t_ind + 8
    loop
      if p_file_name =
           raw2varchar2
             ( dbms_lob.substr( p_zipped_blob
                              , raw2num( dbms_lob.substr( p_zipped_blob
                                                        , 2
                                                        , t_hd_ind + 28
                              , t_hd_ind + 46
             , p_encoding
      then
        if dbms_lob.substr( p_zipped_blob
                          , 2
                          , t_hd_ind + 10
                          ) = hextoraw( '0800' )                -- deflate
        then
          t_fl_ind :=
                raw2num( dbms_lob.substr( p_zipped_blob
                                        , 4
                                        , t_hd_ind + 42
          t_tmp := hextoraw( '1F8B0800000000000003' );          -- gzip header
          dbms_lob.copy( t_tmp
                       , p_zipped_blob
                       , raw2num( dbms_lob.substr( p_zipped_blob
                                                 , 4
                                                 , t_fl_ind + 19
                       , 11
                       ,   t_fl_ind
                         + 31
                         + raw2num( dbms_lob.substr( p_zipped_blob
                                                   , 2
                                                   , t_fl_ind + 27
                         + raw2num( dbms_lob.substr( p_zipped_blob
                                                   , 2
                                                   , t_fl_ind + 29
          dbms_lob.append( t_tmp
                         , dbms_lob.substr( p_zipped_blob
                                          , 4
                                          , t_fl_ind + 15
          dbms_lob.append( t_tmp
                         , dbms_lob.substr( p_zipped_blob, 4, t_fl_ind + 23 )
          return utl_compress.lz_uncompress( t_tmp );
        end if;
        if dbms_lob.substr( p_zipped_blob
                          , 2
                          , t_hd_ind + 10
                          ) =
                      hextoraw( '0000' )
                                        -- The file is stored (no compression)
        then
          t_fl_ind :=
                raw2num( dbms_lob.substr( p_zipped_blob
                                        , 4
                                        , t_hd_ind + 42
          return dbms_lob.substr( p_zipped_blob
                                , raw2num( dbms_lob.substr( p_zipped_blob
                                                          , 4
                                                          , t_fl_ind + 19
                                ,   t_fl_ind
                                  + 31
                                  + raw2num( dbms_lob.substr( p_zipped_blob
                                                            , 2
                                                            , t_fl_ind + 27
                                  + raw2num( dbms_lob.substr( p_zipped_blob
                                                            , 2
                                                            , t_fl_ind + 29
        end if;
      end if;
      t_hd_ind :=
          t_hd_ind
        + 46
        + raw2num( dbms_lob.substr( p_zipped_blob
                                  , 2
                                  , t_hd_ind + 28
        + raw2num( dbms_lob.substr( p_zipped_blob
                                  , 2
                                  , t_hd_ind + 30
        + raw2num( dbms_lob.substr( p_zipped_blob
                                  , 2
                                  , t_hd_ind + 32
    end loop;
    return null;
  end;
  function little_endian(
    p_big in number
  , p_bytes in pls_integer := 4
    return raw
  is
  begin
    return utl_raw.substr
                  ( utl_raw.cast_from_binary_integer( p_big
                                                    , utl_raw.little_endian
                  , 1
                  , p_bytes
  end;
  procedure add1file(
    p_zipped_blob in out blob
  , p_name in varchar2
  , p_content in blob
  is
    t_now date;
    t_blob blob;
    t_clen integer;
  begin
    t_now := sysdate;
    t_blob := utl_compress.lz_compress( p_content );
    t_clen := dbms_lob.getlength( t_blob );
    if p_zipped_blob is null
    then
      dbms_lob.createtemporary( p_zipped_blob
                              , true
    end if;
    dbms_lob.append
      ( p_zipped_blob
      , utl_raw.concat
          ( hextoraw( '504B0304' )              -- Local file header signature
          , hextoraw( '1400' )                  -- version 2.0
          , hextoraw( '0000' )                  -- no General purpose bits
          , hextoraw( '0800' )                  -- deflate
          , little_endian
              (   to_number( to_char( t_now
                                    , 'ss'
                                    ) ) / 2
                + to_number( to_char( t_now
                                    , 'mi'
                                    ) ) * 32
                + to_number( to_char( t_now
                                    , 'hh24'
                                    ) ) * 2048
              , 2
              )                                 -- File last modification time
          , little_endian
              (   to_number( to_char( t_now
                                    , 'dd'
                + to_number( to_char( t_now
                                    , 'mm'
                                    ) ) * 32
                + ( to_number( to_char( t_now
                                      , 'yyyy'
                                      ) ) - 1980 ) * 512
              , 2
              )                                 -- File last modification date
          , dbms_lob.substr( t_blob
                           , 4
                           , t_clen - 7
                           )                                         -- CRC-32
          , little_endian( t_clen - 18 )                    -- compressed size
          , little_endian( dbms_lob.getlength( p_content ) )
                                                          -- uncompressed size
          , little_endian( length( p_name )
                         , 2
                         )                                 -- File name length
          , hextoraw( '0000' )                           -- Extra field length
          , utl_raw.cast_to_raw( p_name )                         -- File name
    dbms_lob.copy( p_zipped_blob
                 , t_blob
                 , t_clen - 18
                 , dbms_lob.getlength( p_zipped_blob ) + 1
                 , 11
                 );                                      -- compressed content
    dbms_lob.freetemporary( t_blob );
  end;
  procedure finish_zip(
    p_zipped_blob in out blob
  is
    t_cnt pls_integer := 0;
    t_offs integer;
    t_offs_dir_header integer;
    t_offs_end_header integer;
    t_comment raw( 32767 )
                 := utl_raw.cast_to_raw( 'Implementation by Anton Scheffer' );
  begin
    t_offs_dir_header := dbms_lob.getlength( p_zipped_blob );
    t_offs := dbms_lob.instr( p_zipped_blob
                            , hextoraw( '504B0304' )
                            , 1
    while t_offs > 0
    loop
      t_cnt := t_cnt + 1;
      dbms_lob.append
        ( p_zipped_blob
        , utl_raw.concat
            ( hextoraw( '504B0102' )
                                    -- Central directory file header signature
            , hextoraw( '1400' )                                -- version 2.0
            , dbms_lob.substr( p_zipped_blob
                             , 26
                             , t_offs + 4
            , hextoraw( '0000' )                        -- File comment length
            , hextoraw( '0000' )              -- Disk number where file starts
            , hextoraw( '0100' )                   -- Internal file attributes
            , hextoraw( '2000B681' )               -- External file attributes
            , little_endian( t_offs - 1 )
                                       -- Relative offset of local file header
            , dbms_lob.substr
                ( p_zipped_blob
                , utl_raw.cast_to_binary_integer
                                           ( dbms_lob.substr( p_zipped_blob
                                                            , 2
                                                            , t_offs + 26
                                           , utl_raw.little_endian
                , t_offs + 30
                )                                                 -- File name
      t_offs :=
          dbms_lob.instr( p_zipped_blob
                        , hextoraw( '504B0304' )
                        , t_offs + 32
    end loop;
    t_offs_end_header := dbms_lob.getlength( p_zipped_blob );
    dbms_lob.append
      ( p_zipped_blob
      , utl_raw.concat
          ( hextoraw( '504B0506' )       -- End of central directory signature
          , hextoraw( '0000' )                          -- Number of this disk
          , hextoraw( '0000' )          -- Disk where central directory starts
          , little_endian
                   ( t_cnt
                   , 2
                   )       -- Number of central directory records on this disk
          , little_endian( t_cnt
                         , 2
                         )        -- Total number of central directory records
          , little_endian( t_offs_end_header - t_offs_dir_header )
                                                  -- Size of central directory
          , little_endian
                    ( t_offs_dir_header )
                                       -- Relative offset of local file header
          , little_endian
                ( nvl( utl_raw.length( t_comment )
                     , 0
                , 2
                )                                   -- ZIP file comment length
          , t_comment
  end;
  procedure save_zip(
    p_zipped_blob in blob
  , p_dir in varchar2 := 'MY_DIR'
  , p_filename in varchar2 := 'my.zip'
  is
    t_fh utl_file.file_type;
    t_len pls_integer := 32767;
  begin
    t_fh := utl_file.fopen( p_dir
                          , p_filename
                          , 'wb'
    for i in 0 .. trunc(  ( dbms_lob.getlength( p_zipped_blob ) - 1 ) / t_len )
    loop
      utl_file.put_raw( t_fh
                      , dbms_lob.substr( p_zipped_blob
                                       , t_len
                                       , i * t_len + 1
    end loop;
    utl_file.fclose( t_fh );
  end;
end;
/

Similar Messages

  • How to find number of files in a folder using pl/sql

    please someone guide as to how to find number of files in a folder using pl/sql
    Regards

    The Java option works well.
    -- results table that will contain a file list result
    create global temporary table directory_list
            directory       varchar2(1000),
            filename        varchar2(1000)
    on commit preserve rows
    -- allowing public access to this temp table
    grant select, update, insert, delete on directory_list to public;
    create or replace public synonym directory_list for directory_list;
    -- creating the java proc that does the file listing
    create or replace and compile java source named "ListFiles" as
    import java.io.*;
    import java.sql.*;
    public class ListFiles
            public static void getList(String directory, String filter)
            throws SQLException
                    File path = new File( directory );
                    final String ExpressionFilter =  filter;
                    FilenameFilter fileFilter = new FilenameFilter() {
                            public boolean accept(File dir, String name) {
                                    if(name.equalsIgnoreCase(ExpressionFilter))
                                            return true;
                                    if(name.matches("." + ExpressionFilter))
                                            return true;
                                    return false;
                    String[] list = path.list(fileFilter);
                    String element;
                    for(int i = 0; i < list.length; i++)
                            element = list;
    #sql {
    insert
    into directory_list
    ( directory, filename )
    values
    ( :directory, :element )
    -- creating the PL/SQL wrapper for the java proc
    create or replace procedure ListFiles( cDirectory in varchar2, cFilter in varchar2 )
    as language java
    name 'ListFiles.getList( java.lang.String, java.lang.String )';
    -- punching a hole in the Java VM that allows access to the server's file
    -- systems from inside the Oracle JVM (these also allows executing command
    -- line and external programs)
    -- NOTE: this hole MUST be secured using proper Oracle security (e.g. AUTHID
    -- DEFINER PL/SQL code that is trusted)
    declare
    SCHEMA varchar2(30) := USER;
    begin
    dbms_java.grant_permission(
    SCHEMA,
    'SYS:java.io.FilePermission',
    '<<ALL FILES>>',
    'execute, read, write, delete'
    dbms_java.grant_permission(
    SCHEMA,
    'SYS:java.lang.RuntimePermission',
    'writeFileDescriptor',
    dbms_java.grant_permission(
    SCHEMA,
    'SYS:java.lang.RuntimePermission',
    'readFileDescriptor',
    commit;
    end;
    To use:
    SQL> exec ListFiles('/tmp', '*.log' );
    PL/SQL procedure successfully completed.
    SQL> select * from directory_list;
    DIRECTORY FILENAME
    /tmp X11_newfonts.log
    /tmp ipv6agt.crashlog
    /tmp dtappint.log
    /tmp Core.sd-log
    /tmp core_intg.sd-log
    /tmp da.sd-log
    /tmp dhcpclient.log
    /tmp oracle8.sd-log
    /tmp cc.sd-log
    /tmp oms.log
    /tmp OmniBack.sd-log
    /tmp DPISInstall.sd-log
    12 rows selected.
    SQL>

  • How to create a Folder using a SQL Query?

    Hi
    How can I create a Folder (eg. C:\MyNewFolder) using SQL Query?

    Hi,
    I added some code in order to get the result from the xp_cmdshell command
    This returns null if successfull, if an error occurs returns the error message. May be useful instead of getting an sql error
    Code Snippet
    declare @cmdpath nvarchar(60), @Location nvarchar(100), @message nvarchar(max)
    set @Location = N'C:\Temp\Temp5'
    set @cmdpath = 'MD '+ @Location
    Create table #result
    result nvarchar(255)
    insert into #result (result) exec master.dbo.xp_cmdshell @cmdpath
    select @message = ISNULL(@message + ' - ','') + result from #result where result is not null
    select @message
    drop table #result
    Eralper
    http://www.kodyaz.com

  • Create windows folder with PL/SQL only

    Hi
    I need to create a folder using PL/SQL only.
    We are using Oracle 10.2.0.1.0
    Thanks.

    No can do. Not with PL/SQL alone. You'd need a Java Stored Procedure and even then, it would create folders on the server.
    Why would you use a database for OS administration?
    Message was edited by:
    maaher

  • How to create a folder using plsql

    hi all
    i want create a folder using plsql procedures .

    I am not sure weather you can create a folder on database server file system using pl/sql code but you certainly can create/read/write file system files using UTL_FILE package.
    'The Oracle supplied package UTL_FILE can be used to read and write files that are located on the server. It cannot be used to access files locally, that is on the computer where the client is running.'

  • Problem Dropping Objects in Oracle XE using PL/SQL Developer

    Hi all,
    I am using PL/SQL Developer to access Oracle XE. I created some tables and later dropped them. But I still see some objects in the PL/SQL Developer Browser under the Tables section.
    Below is the name of the objects in I see:
    bin$fj7zj7y9rhqujmwrz1zmtg==$0,
    bin$frxjknkot4cwtkexm4wtca==$0,
    bin$q2m8wls+s72szfufb+mnzw==$0,
    bin$syrcyj1bsqcelpfsodudrw==$0,
    bin$tjt8ipk6ras8qtx0zvn+6w==$0,
    bin$vc6dzazorg6zwemticqdha==$0,
    bin$xfrxhcb3s5ev8wkjfc/3vg==$0,
    bin$oyrdsi+us+yhhoprzdingq==$0,
    bin$vtk7saqqtecbhmdwpnp1bg==$0,
    bin$x1hhdhy+trmfponyldjwdw==$0
    When I tried dropping these objects, I get ORA - 00933: SQL Command not properly ended. Error deleting bin$fj7zj7y9rhqujmwrz1zmtg==$0
    How do I resolve this problem? And then drop all those objects listed above.
    Is it possible to drop those objects at all?
    Thanks in advance.
    Sam.

    There is no problem sofar. The objects you see are dropped objects ( if you drop it, oracle silently rename the object but preserve it as long you have sufficient space ).
    You shouldn't drop them if you don't have issue with free space - they enable you to get back accidentally dropped table without to have restore the backup ( flashback table). If you are annoyed by displaying it in PL SQL Developer, you can just add a filter to not show them to you ( all objects like 'bin%' ) or you can update to newrer version of PL SQL Developer ( i've 7.0.0.1050 and it is displayed properly, all dropped objects can be found under recyclebin folder ). Finally , if you want purge them, use the 'purge recyclebin' command.
    Best regards
    Maxim

  • Getting the schema using Oracle SQL Developer 1.5.1

    I need to generate a report in CSV/XLS format using Oracle SQL Developer 1.5.1 to get the schema details
    in the below format.
    Table Name: XXXXXXXXX
    Table Space Name: XXXXXXXXXXXXXXX
    Structure :
    Field Name Data Type Size
    Xxxxxxxx xxxxxx xxxxx
    Xxxxxxxx xxxxxx xxxxx
    Xxxxxxxx xxxxxx xxxxx
    Xxxxxxxx xxxxxx xxxxx
    Field level constraint:
    Xxxxxxxxxxxxxxxxxx
    Table Level Constraint:
    Xxxxxxxxxxxxxxxxxx
    Indexes:
    Index Name Column Name(s) Table space name
    Xxxxxxxx xxxxxxxxx xxxxxxxxxxxx
    Xxxxxxxx xxxxxxxxx xxxxxxxxxxxx
    Xxxxxxxx xxxxxxxxx xxxxxxxxxxxx
    Sequence Number:
    Xxxxxxxxxxxxxxxx
    Triggers:
    Xxxxxxxxxxxxxxxxxx
    I am using a query to do that, but I cannot run more than one queries in the Create Report Dialog.
    I went to the Menu->View->Reports. In that, I chose User Defined Reports, created a new folder called Schema Detail and in that a report named Schema Detail. I right click on that report, choose Edit option, Create Report Dialog opens.
    In the Create Report Dialog, I chose the option Script for Value of Style.
    In the SQL column I enter a query "select * from table_names". But, if I enter another query after that, it does not run and reports an error "SQL Error: ORA-00933: SQL command not properly ended
    00933. 00000 - SQL command not properly ended" Cause:    Action: "
    I end the first query with a semi colon, but it does not work.
    The queries run fine in a SQL Worksheet. There, I can terminate the first query with a semi colon and enter the second query. Then, I run both of them together so that result-set of second query appears after the second.
    Am I doing something wrong? Can someone please advise on how to get the information I need?
    Thanks a lot.

    You can do it in SQL Worksheet because you are running a script. You could run the script in SQL*Plus, and even start it from a bat/cmd file.
    Or if you want this as a User Defined Report, you might make it a PL/SQL style report. Here, all output is done through DBMS_OUTPUT.PUT or DBMS_OUTPUT.PUT_LINE. You can output HTML tags or plain text. I have an example in my paper for ODTUG Kaleidoscope 2009.

  • URGENT: Content Services using PL/sql utl_http

    I'm using Oracle Collaboration Suite Content Services Version 10.1.2.0.0 (Oracle 10g Enterprise Edition Release 10.1.0.4.0).
    Using PL/sql, I want to be able to retrieve a html document stored in a folder in Content Services, and store the contents of that document in a table.
    I can retrieve and store the contents of the document if it stored anywhere - I just can't when the document resides in Content Services.
    Within PL/sql I am authenticating using utl_http.set_authentication, then using utl_http.request_pieces.
    I'm not getting an error message, just the "<" character stored in my table.
    Can I not use utl_http.request_pieces for retrieving a document in Content Services?
    Thanks
    Paul

    HI Michiel
    I am also trying to achieve something similar to that. I am trying to call a web service that sends an xml attachment over MTOM? Kindly, let me know if this was achievable from your end? I mean how did the issue got resolved.
    thanks
    vijay

  • Extracting compressed file (zip) using PL/SQL

    Hi!
    Can anyone help me on how to extract data out of a compressed file(ZIP) using pl sql.
    Regards,
    dhekz

    user8707902 wrote:
    Can anyone help me on how to extract data out of a compressed file(ZIP) using pl sql.Bear in mind that the Lempel-Zif-Welch (LZW) compression used in zip files may still have patent issue relating to Unisys (not sure of the patent has expired now or what, it's always been somewhat confusing). So, if you already have software written to zip/unzip files you should use that as it should be licenced already. If you write your own LZW compression/decompression routine for use in any commercial software you may be required to register and submit royalties to Unisys for the privilege. As I say, I don't know the latest, so you may be ok, but it's something to be aware of and check out if you intend to write your own and it's for commercial reasons.

  • How read the PDF and XML files after Unzipping the folder

    Hi Gurus,
    I have a zipped folder and i this two types of files .XML and .PDF files.
    I am able to unzip the folder and reading the .XML files, unable to read the PDF files.
    I want to send this PDF file to the target as it is.
    Please help me.
    Regards
    Sreeni

    Hi,
    Hi ,
    Plse see the below thread
    PI 7.1 : Taking a input PDF file and mapping it to a hexBinary attribute
    It will help you.
    You can write custom adapter modules:
    Java Mappingh;
    SAP Conversion agent:
    http://www.riyaz.net/blog/parsing-pdf-files-using-sap-conversion-agent-part-i/technology/sap/628/
    http://help.sap.com/saphelp_nw04/helpdata/en/43/4c38c4cf105f85e10000000a1553f6/content.htm

  • Create new resource in XDB using PL/SQL problem

    Hi Forum,
    I'm struggling with the problem of creating folders and resources automatically using PL/SQL. I'm working with Oracle 9.2
    What I'd like to achieve is a proc like so:
    create_folder(path in varchar2)
    This proc should create the folder for me. Problem is:
    1. If a subfolder is not existing, dbms_xdb.create_folder throws an error.
    2. If a folder is existing, the same happens.
    So my approach is:
    split the path '/a/b/c/d/test.xml' into chunks like:
    /a
    /a/b
    /a/b/c
    /a/b/c/d
    Now, check for each entry, whether folder exists. If not, create folder.
    The way I implemented this is by a pipelined PL/SQL function split_path:
    create type path_table as table of varchar2;
    create or replace function split_path (path in varchar2)
    return path_table pipelined
    is
    i number := 1;
    begin
    while instr(path, '/', 2, i) > 0 loop
    pipe row (substr(path, 1, instr(path, '/', 2, i) - 1));
    i := i + 1;
    end loop;
    return;
    end split_path;
    This function pumps out any sub-path.
    Now, I create a create_folder function like so:
    procedure create_folder (path in varchar2)
    is
    i number := 1;
    -- cursor for all non-existing pathes (via pipelined function split_path)
    cursor path_cur is
    select column_value
    from table(mds_tools.split_path(path))
    where column_value not in (select any_path from resource_view);
    begin
    -- Create all non-existing folders
    for entry in path_cur loop
    result := dbms_xdb.createFolder(entry.column_value);
    end loop;
    -- exception handling goes here
    end create_folder;
    So, this way, I'm checking any sub folder against the existing cursors and try to create a folder if it's not existing.
    Nice try, so far, but: It doesn't work.
    Oracle gives me an "End of communication" error, when trying to run this.
    It seems to bomb out as soon as the second pipe is pumped out of the function and I don't understand, why.
    If this should be the wrong approach, how could I improve this?
    Thanks for any help,
    Jürgen

    Sorry, two little mistakes:
    Procedure create_folder shoule read like this:
    create or replace procedure create_folder (path in varchar2)
    is
    i number := 1;
    result boolean;
    -- cursor for all non-existing pathes (via pipelined function split_path)
    cursor path_cur is
    select column_value
    from table(split_path(path))
    where column_value not in (select any_path from resource_view);
    begin
    -- Create all non-existing folders
    for entry in path_cur loop
    result := dbms_xdb.createFolder(entry.column_value);
    end loop;
    -- exception handling goes here
    end create_folder;

  • How can I open a local folder using flash builder or AS3?

    I need to open a local folder get the zip file and unzip it.
    I know that i cannot open a folder using flash builder, i did it using air app. now i do not know how do i integrate it with my flex program.
    Please help me with this issue.
    Thanks

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script source="Asset/folder.as" />
    <mx:Button x="10" y="10" label="My Button" width="122" height="31" id="myButton" click="folder()"/>
    <mx:ComboBox x="10" y="49" id="cbobx" dataProvider="{}"  ></mx:ComboBox>
    </mx:Application>
    and .as code is:
    // ActionScript file
    import flash.display.*;
    import flash.events.*;
    import flash.net.FileFilter;
    import flash.net.FileReference;
    import flash.net.FileReferenceList;
    import mx.controls.Alert;
    import mx.controls.ComboBox;
    private var fr:FileReferenceList;
    private var cmbobx:ComboBox = new ComboBox();
        private function folder():void
    fr = new FileReferenceList();
    fr.browse([new FileFilter("Zip Files", "*.zip")]);
    fr.addEventListener(Event.SELECT, listZipFiles);
    private function listZipFiles(e:Event):void
    Alert.show("selectHandler: " + fr.fileList.length + " files");
            var fls:Array = new Array();
            var file:FileReference;
            for (var i:uint = 0; i < fr.fileList.length; i++)
                file = FileReference(fr.fileList[i]);
                //Alert.show("File Name: " + fr.fileList[i]);
                Alert.show("File Name: " + file.name);
                fls.push(file);
                cmbobx.selectedItem = fls;
    private function getShpFiles(event:MouseEvent):void

  • Using a SQL data source and XML data source in the same template

    I am trying to develop a template for the Request for Quote report generated in Apps 11.5.10. I have loaded the data from the XML output into the template, but I am missing one field - I need the org_id from the po_headers table. Is it possible to use a sql data source (i.e., "select org_id from po_headers_all where po_header_id = [insert header_id from xml data]...") in addition to the xml data source to populate the template at runtime? When you use the Insert > SQL functionality is it static at the time the template is created, or does it call to the database at runtime? I've looked through all the docs I could find, but this isn't clear.
    Thanks for any help or suggestions you may have.
    Rhonda

    Hi Pablo
    Thats a tough one ... if you go custom with a data template you will at least get support on the data template functionality ie you have a problem when you try and build one. You will not get support on the query inside the data template as you might have gotten with the Oracle Report, well you could at least log a bug against development for a bad query.
    Eventually that Oracle Report will be converted by development anyway, theres an R12 project going on right now to switch the shipped OReports to data templates. AT this point you'll be fully supported again but:
    1. You have to have R12 and
    2. You'll need to wait for the patch
    On reflection, if you are confident enough in the query then Oracle will support you on its implementation within a data template. Going forward you may be able to swap out your DT and out in the Oracle one without too much effort.
    Regards, Tim

  • How can i use one SQL statement to solve problem?

    How can i use one SQL statement to solve the question below?
    For a Table named A, there is a column named F(char type).
    Now select all the records where F like '%00' and update their F value to '%01'
    Just one SQL statement.Do not use PL/SQL block.
    How to do that?
    Thanks.

    What is the data volume for this table?
    Do you expect lots of rows to have '%00' as their value?
    Following two statements come to mind. Other experts would be able to provide better alternatives:
    If you have index on SUBSTR(f, 2):
    UPDATE A
    SET    f = SUBSTR(f,
                      1,
                      length(f) - 2) || '01'
    WHERE  substr(f,
                  -2) = '00';If most of the rows have pattern '%00':
    UPDATE A
    SET    f = SUBSTR(f,
                      1,
                      length(f) - 2) ||
               DECODE(SUBSTR(f,
                             -2),
                      '00',
                      '01',
                      SUBSTR(f,
                             -2));

  • Using a SQL Query in an Alert and Matching a String

    I've created an alert in 12.0.4 using a SQL Query and the field that I'm trying to match is a string.  Originally the query returned multiple rows but when the alert still didn't fire, I modified the query WHERE clause to return only one row:
    NAME                                RESPONSE
    Are area lights working?            No
    My expression in the metric is RESPONSE.  In the Monitor I'm matching a string equal to No.  (Do I need double quotes around the matchvalue?  Single quotes?  No quotes?)  The metric is in the 15min scan group, the role is xMII Developers and I'm in that role. The monitor alert string is ' =  '.  Both metric and monitor are active and I've subscribed to the monitor.  Other alerts in the 15min scan group (all based on tag queries) are firing off properly.
    Why is nothing showing up in the Alert Log?
    David Macindoe

    David,
    Did you figure out the answer?  If not, I will try to find someone to address your question.
    Mike

Maybe you are looking for

  • Creating projects with more that one exported sequences from different FCP

    I am creating a compilation DVD containing 6 different FCP projects. I exported all the projects using the same settings MPEG-2 6.2Mbps 1-pass 4:3.m2v and .aiff files. They each burn and play just fine when I use just one in a DVD Studio project. The

  • How to consume Web Services form ABAP ?

    Hi, Please advise how to consume web services from ABAP Code ? is there any automatic generating proxy class in order to consume web services ? I am using NW 7.0 SP15 Thank You and Best Regards Fernand Lesmana

  • Problems with terminating event

    Hi all, I defined a terminating event for a task. I want all instances of this task to be completed when raising the event. I made the binding of the object. I defined the event as  a instance linkage(is this correct?) Does a terminating event works

  • Spry Table - way to select only parts of the dataset to be displayed?

    I have been enjoying putting together a simple spry table (DW CS3) that pulls data from an xml file.  At this point when the table loads it pulls all rows from the dataset and displays them in the table.  My question: is it possible to create a link

  • Date search with any format in oracle

    Hi Friends i have Problem with the date format In Db i have column with message (VARCHAR2) like. Admin~Assigned ~01-08-2013 03:12:35~ [email protected] Admin~Assigned ~01-AUG-2013 03:12:35~TEXT [email protected] Admin~Assigned ~01-JAN-13 03:12:35~tex