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

Similar Messages

  • How to create a counter using Oracle SQL Developer?

    Is there any way to create a counter using Oracle SQL Developer to create the below scenario. Meaning it will recorded down the name of user and ID and time and the date they login.
    Library portal home statistics shows how many users (outside and within the campus) visit the library portal.
    Page Access statistics is recorded on an hourly basis. Users may select the statistics by
    yearly (statistics displayed by all months in the selected year)
    monthly (statistics displayed by all days in the selected month)
    daily (statistics displayed by all hours in the selected day)

    I'm giving here one basic post - hope this will solve your problem --
    SQL>
    SQL>
    SQL> create table audit_info
      2   (
      3     usr        varchar2(50),
      4     log_time   timestamp(6)
      5    );
    Table created.
    SQL>
    SQL>
    SQL>  create table err_log
      2     (
      3       log_cd      varchar2(20),
      4       log_desc    varchar2(500)
      5     );
    Table created.
    SQL>
    SQL>
    SQL>   create or replace procedure ins_err(errcd   in  varchar2,
      2                                        errnm   in  varchar2)
      3    is
      4      pragma autonomous_transaction;
      5    begin
      6      insert into err_log values(errcd,errnm);
      7      commit;
      8    end;
      9  /
    Procedure created.
    SQL>
    SQL>
    SQL>   create or replace procedure ins_aud(ud   in varchar2,
      2                                        unm  in varchar2)
      3    is
      4      pragma autonomous_transaction;
      5    begin
      6      insert into audit_info values(ud,unm);
      7      commit;
      8    exception
      9      when others then
    10        ins_err(sqlcode,sqlerrm);
    11    end;
    12  /
    Procedure created.
    SQL>
    SQL>
    SQL>
    SQL> create or replace trigger log_odsuser1
      2   after logon on odsuser1.schema
      3   begin
      4     ins_aud('ODSUSER1',sysdate);
      5   exception
      6     when others then
      7       ins_err(sqlcode,sqlerrm);
      8   end;
      9  /
    Trigger created.
    SQL>
    SQL*Plus: Release 9.2.0.1.0 - Production on Tue Jun 12 12:21:09 2007
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.6.0 - Production
    SQL>
    SQL>
    SQL>
    SQL> set serveroutput on
    SQL>
    SQL>
    SQL> select * from audit_info;
    USR
    LOG_TIME
    ODSUSER1
    12-JUN-07 12.00.00.00000000 AMHope this will solve your purpose.
    Regards.
    Satyaki De.

  • 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.'

  • How to create a Folder using java.

    Hi All,
    I have a doubt. I want to create a folder using java.
    Inputs are the destination where the folder should be created and the name of the folder. Plz help me in this regard.
    thanks and regards,
    Vincent .R.

    check out javadoc for java.io
    File reldir=new File("NewDir");//relatively where your program runs
    reldir.mkdir();
    File absdir=new File("C:/NewDir");//absolute path
    reldir.mkdir();
    File newdir=new File(absdir,"SubDir");//defines another dir under absdir
    newdir.mkdir();
    Gil

  • How to create tables for using in SQL/php website

    Sorry for asking basic question because I 'm knew.
    i was building a dw site for listing multiple products. i was following DW, the Missing Manual book tutorials. The tutorial offers downloadable data tabels in a folder with .sql extension. I just cannot find anywhere an instruction as how the .sql folder is created.
    Second question: if it can be created in Access 2007, please tell me how.
    thank you sooo much.

    Hi Walt,
    Thank you so much for spending the time trying to answer me.
    you are right, it is a .sql file, not a folder. However, once it is imported into MySQL server, it spits out 4 tables. Please see the following tutorial steps:
    "4. in phpMyAdmin's top navigation bar, click the Import button.
    Doing so takes you to a page that lets you type in an SQL query or load a test file that has SQL commands in it. You'll do the latter-load a text file that contains all the SQL necessary to create the tables and data for the database.
    5. Click the Browse button in XAMPP (application software for SQL server), In the File Upload window that appears, navigate to and select the file cosmofarmer.sql in the php_dynamic folder you downloaded with the tutorial files.
    6. Click the Go button.
    The MySQL server slurps down the SQL file, and executes the instructions found within it. The results? Four new talbes are created (see the list of talbles that just appeared on the left side of the phpMyAdmin window) and a bunch of data is added to them. "
    The book I am reading explains everything but how the cosmofarmer.sql file was made.

  • How to create a database using a SQL statement? Please help.

    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.25:1521:mydb","system","12345678");
    but mydb database does not exist.
    I want to make a connection to oracle server without database name.
    How can I do?

    Colleauge, what is the purpose of making a connection to a non-existent database.
    connections are made to the database to retrieve some data or put some data.
    for which the database should exists.
    so please create the mydb database first using Database Configuration Assistant (DBCA) which is much easier as it is GUI based rather than doing it with sql scripts.

  • 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 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 custom folder for parameterized query

    Hi Gurus,
    I developed a query to generate report to " who is reporting to who in organization", when i am trying to create custom folder using this query but i am getting error like "The custom sql entered contains parameter and therefore invalid". Could you please help to parameterize the emp_key in query in Oracle Discoverer. Is there any way to pass the value using external procedure for this query.
    SELECT
    lpad(' ', 8 *(LEVEL -1)) || emp_last_name, emp_key, manager_id, emp_key, manager_key,
    mgr_last_name, mgr_first_name, empid,
    emp_last_name, emp_first_name, LEVEL FROM cmp_ppl1 START WITH emp_key = &emp_key
    CONNECT BY PRIOR emp_key = manager_key;
    Thanks & Regards
    Vikram

    I agree 100% that it's way easier to create a dataview or a custom folder - with no run time parameters being passed to the EUL - as is being done by Vikram.
    The only concern I would have is that I don't know if it would work - or at least ever come back in reasonable time - for Vikram and therefore the question about parameters (only Vikram can say).
    The reason I'm wondering is that I've created SQL similar to being shown (when used in an org chart report at a large client) and the start / connect by is used for going down the tree getting everyone on the way. And if it's not limited - that could be a huge undertaking - of records and/or time. Guess it depends on how many people work at the organization (and of course, levels).
    But otherwise, absolutely, I would try and bring back all logical records to the folder and then filter in Disco.
    Russ

  • How to create the folder in presentation server through pop-up(

    Hi Experts,
    Can u give me the solution , how to create the folder in presentation server through pop-up(means dynamically, after executing the program , pop-up has to come to create the folderand path)
    regards
    ram.

    Use the methods -> DIRECTORY_BROWSE & DIRECTORY_CREATE of the class CL_GUI_FRONTEND_SERVICES
    DATA: path TYPE string,
          rc TYPE i,
    dir_name TYPE string value 'HI'.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE
        CHANGING
          SELECTED_FOLDER      = path
      IF SY-SUBRC <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    concatenate path '\' dir_name into path.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_CREATE
        EXPORTING
          DIRECTORY                = path
        CHANGING
          RC                       = rc
      IF SY-SUBRC <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Edited by: Kartik Tarla on Sep 23, 2009 5:54 PM

  • 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;
    /

  • How to create a folder for a specific e-mail account?

    How to create a folder for a specific e-mail account?
    I'm using a POP e-mail account and I would like to create folders / sub-folders... how can I do this?

    You can right click on your Desktop and select New Folder.  In Finder File > New Folder should work too, not in front of my Mac.
    Welcome to back by the way.  You might find these websites helpful.
    Switch 101
    Mac 101

  • How to create a folder to store my mail?

    hi,
    can u tell me how to create a folder to store my outgoing mails using java mail.
    Million Thanks for u
    With luv
    kathir

    hi chiru,
    Thanks for ur reply.Can u tell me how to configure IMAP.I've tried to configure IMAP in outlook and then i run the program with the code u sent,but it throws
    " javax.mail.NoSuchProviderException: No provider for IMAP
    at javax.mail.Session.getProvider(Session.java:289)
    at javax.mail.Session.getStore(Session.java:363)
    at javax.mail.Session.getStore(Session.java:343)
    at MessageSend.main(MessageSend.java:61)
    Plz give me some soln for this excep.
    Thanks in advance
    Regs
    Kathiravan

  • How to create a folder (in unified folders) which contains all the messages of inboxes and outboxes

    Hi, i've searched without success how to create a folder (in unified folders) which contains all the messages of inboxes and outboxes (as it exists in Windows Live Mail).
    For me, it would be very useful to search in only one folder when i try to find something in sent and received mails.
    Thank's

    This is what Unified Folders does. I'm not sure what exactly you're trying to achieve.
    http://kb.mozillazine.org/Global_Inbox#Unified_Folders
    You might take a look at this article.
    https://support.mozilla.org/en-US/kb/global-search

  • How to create user defined metrics for SQL Server target?

    The customer is not able to create a user defined metrics for SQL Server target.
    This is very important for him to use this product.
    He is asking how to create user defined metrics?
    I sent him Note 304952.1 How to Create a User-Defined SQL Metric in EM 10g Grid Control
    But it would work for an Oracle DB, but his target is SQL Server DB
    Not able to find the "User-Defined Metrics" link from Database home page.
    How to create user defined metrics for SQL Server target?

    http://download-uk.oracle.com/docs/cd/B14099_19/manage.1012/b16241/Monitoring.htm

Maybe you are looking for