Reading a file of OS with size greater than 32 KB line

Hi experts,


I have a PL/SQL function that reads a file generated by a product of part 3 - Windows product displays a single line of text. I intend to read the file into pieces of 32K, do some string manipulation and copy into a CLOB that I spend for further processing. He eventually embeded in a CLOB containing WordML and output to a file. The CLOB is not saved in the database.

I use UTL_FILE for work, FOPEN and GET_LINE. However, this operation fails for files with more than 32K characters in the line. Is there another way I can read the file?

Obviously I can do processing on the file outside the Oracle to divide it into smaller lines, however, this will affect performance.

Kind regards
Arun

Hello Arun,

Welcome to the forum.

You can read a file directly in a CLOB

CREATE OR REPLACE
FUNCTION getFile
    (
     p_directory     IN all_directories.directory_name%TYPE
    ,p_filename      IN VARCHAR2
    )
    RETURN CLOB
IS
    v_bfile             BFILE;
    v_file              CLOB;
    v_error_out         INTEGER;
    dest_offset         INTEGER := 1;
    src_offset          INTEGER := 1;
    bfile_csid          INTEGER := 0;
    lang_context        INTEGER := dbms_lob.default_lang_ctx;
    e_inconvertibleChar EXCEPTION;
BEGIN

    v_bfile := bfilename( p_directory,p_filename);

    dbms_lob.fileOpen( v_bfile, dbms_lob.file_readonly );

    dbms_lob.createTemporary(v_file, TRUE);

    dbms_lob.loadClobFromfile(
         v_file
        ,v_bfile
        ,dbms_lob.lobMaxSize
        ,dest_offset
        ,src_offset
        ,bfile_csid
        ,lang_context
        ,v_error_out
        );
    dbms_lob.fileClose(v_bfile) ;

    IF v_error_out = dbms_lob.warn_inconvertible_char THEN
        RAISE e_inconvertibleChar;
    ELSIF v_error_out != 0 THEN
        RAISE_APPLICATION_ERROR(-20001,'Unknown errornumber '||v_error_out,TRUE);
    END IF;

    RETURN v_file;

EXCEPTION
    WHEN e_inconvertibleChar THEN
        RAISE_APPLICATION_ERROR(-20001,'Inconvertible charset',TRUE);
END getFile;

Concerning
Marcus

Published by: Marwim on 10.07.2012 17:24

Tags: Database

Similar Questions

  • Reading the file in spreadsheet with a variable number of delimiters

    Dear Forum,

    I would like to read a file in spreadsheet (text) generated by a 3rd party program. It turns out that, while the program generates columns separated by spaces, the number of spaces between the columns varies in a way that I still have to sort out. This isn't a problem if I want to

    to read in the file in excel (or equivalent) - but the functions of 'chain of worksheet to the table' LabView does not seem to be able to deal with him - if I get home 'space' as a separator it only accepts one * only * space... is possible to indicate "zero or more" spaces to this function? [I know I can do a lot of loops and read the elements of a number at a time, but it is very slow, so I'd rather avoid it]

    Thank you

    Niels

    Hello Marshall,.

    The string of worksheet to the table can actually accept an array of delimiters, so you can wire a table 1 d that contains the delimiters you want to watch for--one, two, or three spaces, etc.

    To do this, simply create an array of strings 1 d containing delimiters and son in the entry delimiter in the upper part of the primitive.  Like most primitives, function is polymorphic.

    If the program that generates this file does not limit the spaces he inserts somehow or uses spaces elsewhere in the data, you might encounter problems, but for most cases, I think that should suffice.

    Best regards

  • Increment Dt start with day greater than the Dt at the end of the year Prev in Pro * C

    Morning people and greetings from Toronto.

    I'm trying to change a Pro * C program. Since ages I touched a Pro * C program but I have made an attempt for her. I would probably need some help andhopefully is the right forum I could nto seem to find any section decicated Pro * C programs.

    Here's what its supposed to do. I'm supposed to check if a Start Date of overlap between the start dates and dates from the end of the previous year, and if so, I'm supposed to assign one day Start Date greater than the Date of the end of the previous year.

    I have a control panel that stores records for start date and end Date for each year. Here's what I have for 2010.

    Start date = 8 May 2010 '; End date = may 12, 2011 'year =' 2010 From now the previous record in the table 1 (where the new record is supposed to be inserted) has a record that looks like this:
    DOC_ID     NAME               YEAR         START_DATE     END_DATE
    ------------------------------------------------------------------------------------------------
    999999     Mary Poppins      2009         03-May-2009      08-May-2010
    Now, based on the control table, the Start Date for 2010 coincides with the Date of the end of 2009. In this case, I would need to move the start date = may 9, 2010 "(Date of end + 1)

    Here is my ProC program in hand
    /* Include Headers */
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <ctype.h>
    #include <math.h>
    ---------------------------
    /* Define constants */
    ---------------------------
    #define  nullterm(string) string.arr[string.len] = '\0';
    /* SQL Host Variables */
    exec sql begin declare section;
    exec sql include sqlca;
    
     varchar   ctrl_start_date[11];
     short     ctrl_start_date_ind;
     varchar   ctrl_end_date[11];
     short     ctrl_end_date_ind;
    
     varchar   end_date[11];
     short     end_date_ind;
    
     int       exist_end_date_flag;
     short     exist_end_date_flag_ind;
    
    exec sql end declare section;
    
    
    /* Function Prototypes */
    
    void check_date_overlap();
    
    
    void main(int argc, char *argv[])
    {
    /* Coding starts here */
    
    void get_ctrl_dates()
    {
     exec sql
      select  to_char(trunc(ctrl_start_date),'YYYY/MM/DD'),
              to_char(trunc(ctrl_end_date),'YYYY/MM/DD')
      into    :ctrl_start_date :ctrl_start_date_ind,
              :ctrl_end_date  :ctrl_end_date_ind
      from    control_tb
      where   current_yyyy = :year_number;
    }
    
       check_date_overlap();
    
       if (strcmp( (char *)run_mode.arr,"N")==0)
       {
        check_date_overlap();
        create_person_rec(); /* This will insert record into person_tb table */
       }
    }
    
    /***********************/
    /* CHECK_DATE_OVERLAP  */ 
    /***********************/
    void check_date_overlap()
    {
    
     exist_end_date_flag = 0; /* assume he does not have a record */
    
     exec sql
      select count(*), end_date + 1
      into   :exist_end_date_flag exist_end_date_flag_ind,
             :end_date :end_date_ind
      from   person_tb
      where  doc_id = :doc_id
      and (( :ctrl_start_date between start_date  and end_date ) or
           ( :ctrl_end_date   between start_date  and end_date ) or
           ( start_date between :ctrl_start_date  and :ctrl_end_date ) or
           ( end_date   between :ctrl_start_date  and :ctrl_end_date ))
      and    year_number = (:year_number - 1)
      group by end_date
      having count(*) = 1;
    
      /*** Error Check Routine goes in here ***/
    
      /* Overlapping of dates; Set the Start Date equal End Date + 1 to avoid overlap */
      if (exist_end_date_flag == 1)
      {
       print_to_err_file("The Start Date is overlapping with a previous period.",0);
      }
    
       nullterm(end_date);
    
    } /* check_date_overlap */
    Here would be my question:

    My question is, should the SQL above be written like this instead?
    /***********************/
    /* CHECK_DATE_OVERLAP  */ 
    /***********************/
    void check_date_overlap()
    {
    
     exist_end_date_flag = 0; /* assume he does not have a record */
    
     exec sql
      select count(*), end_date
      into   :exist_end_date_flag exist_end_date_flag_ind,
             :end_date :end_date_ind
      from   person_tb
      where  doc_id = :doc_id
      and (( :ctrl_start_date between start_date  and end_date ) or
           ( :ctrl_end_date   between start_date  and end_date ) or
           ( start_date between :ctrl_start_date  and :ctrl_end_date ) or
           ( end_date   between :ctrl_start_date  and :ctrl_end_date ))
      and    year_number = (:year_number - 1)
      group by end_date;
    
      /*** Error Check Routine goes in here ***/
    
      /* Overlapping of dates; Set the Start Date equal End Date + 1 to avoid overlap */
      if (exist_end_date_flag == 1)
      {
        /* Is this even correct or would I have to do a strcpy?.
            Also note that I am overwriting ctrl_start_date which
            was fetched earlier in get_ctrl_dates() */
       ctrl_start_date = end_date + 1;
       print_to_err_file("The Start Date is overlapping with a previous period.",0);
      }
    
       nullterm(end_date);
    
    } /* check_date_overlap */
    Published by: Raj404261 on June 10, 2009 11:21

    You can put your code between the {code}

    As
    {code}
    your code...
    ...
    {code}

    SS

  • Reading a file MS Word with Tables

    I have experinced a mess when executing this labview program that reads in all tables in a MS Word file and does not see some tables.  The original Word document has hundreds of tables inside and it would be erratic jump a table in the order when he read and run convert text method.

    I reduced the thing down to a file simple word do the same thing.  This VI is not the second table in this document word with 2 tables.  The count property of tables calculated as 2 indicating that the word see 2 tables in the document, but when I try to convert to text the second table I get an indication of infamous error in MS Word and an empty string to the converttotext method.

    Someone knows how to fix?

    It's a delicate question. Here you change the document (with the help of convert to text), and at the end you do not save the changes.

    When you convert a table to text table is more exist and Word reallocate the array indices. In your example after the table 1 is converted to text index 1 is reassign in table 2. In the second iteration, you attempt to get the table with index 2 that no longer exist.

    You can change your code as follows to make it work: tables-> Count value of wire to the N of the loop, wire the constant '1' to the Index value of the item table.

    Ben64

  • Cannot create a VMDK with a size greater than 600 GB on NFS storage

    Hi guys,.

    My institutes use for vSphere, ESXi 4.1U2 with vCenter 4.1 with the based BlueArc storage NFS. Recently, I tried to create a virtual machine with a 900 GB drive. But the operation could not say there is Error Input/ouput. Of the hostd.log, I found:

    ~ # cat /var/log/vmware/hostd.log | grep gagri
    snapshotDirectory = "[gagri_10G_VMPool01]"
    [05-11-2012 14:27:07.431 21F40B90 info 'VmDiskMgr' opID = D2819F21-0003B52F-30] For drive [gagri_10G_VMPool01] new Machine virtual/New Virtual Machine.vmdk, disc creation error: input/output error

    I did several tests and found that any less than 600 GB size is fine.

    Later, I SSH to the ESXi host directly and tried to created a 900 GB VMDK via vmkfstools, surprisingly, it is created without error.

    So I was wondering if there is a bug with vCenter?

    Kind regards

    Derrick

    With ESXi 4.1 Update1, we have a fix for the creation of 1 TB of VMDK on NFS. Maybe you can check the setting below if it helps

    Creation of large hard on NFS files may fail
    When you create a virtual disk (filehard ) with a large size, for example, more than 1 TB, NFS storage, the creation process may fail with an error: a general error has occurred: unable to create the disc: the disc creation error. This problem occurs when the NFS client does not wait for enough time for the storage array NFS to initialize the virtual disk after that the NFS client RPC parameter is to expire. By default the time-out value is 10 seconds. This hotfix provides the configuration option to set the RPC timeout setting using the esxcfg-advcfg- s/NFS/SetAttrRPCTimeout command.

  • Read/write file binary change greater than 128 bytes.

    Hi all, maybe a strange question, but I'm scratching my head on this one. There is undocumented behavior in the function of read/write binary file, where U8 a value greater than 128/0 x 80 get automatically converted to 0x3F value?

    I try to use LabVIEW to generate a binary file custom that we'll load in an EEPROM, so all data in the binary file is stored as values of U8. I have a "template" file, and eventually I'll take the logic implemented to replace the fields with the data from the true value. However, I am struck by the anomaly that when I just read the file in LabVIEW and then réécrirait, all the values 0x80 and more are truncated to 0x3F value. Has anyone seen this before, and is there a solution?

    I noticed writing the value 0 x 80 directly to one generates a binary file (such as a U8) 0 x 90, 0 x 70 being written in the binary file. It is also rather undesirable, as it adds additional bytes in the bytestream, and the bytes of EEPROM must be in exact locations.

    Join your data file.

    This program is to give the images below?  Are you sure that LabVIEW is to write the bytes differently?  I really doubt that.

  • album art with size restrictions?

    Hello. Being new to the "rocket" I wonder if there is a size restriction concerning the album art files?

    I copied many of my audio files directly to the "rocket". View the album art included as folder.jpg in the respective album folder. That has worked well.

    Now, I have a few more added albums today (.) The OGG files) with the files of art with sizes of some 200 kb which do not show...

    any advice? Thank you

    There is a limit to the size of album art and photos.  It has not documented how this size, so I don't think that someone has found the exact limit.  It is also not clear if this is a file size limit of resolution (or both).

    200 KB sounds like extremely large album art.  I found that the "rocket" is a mediocre (and slow) work resizing photos/art.  You will get a much better quality and more vivid in the UI performance if you resize the album art on the drive to 120 x 120 (the size of the art is displayed full-screen coverage).  In addition, you can save space on the drive as well.

  • VDR - vDisk greater than 1 TB

    Hello

    We have a file server that has a greater than 1 TB vDisk. How is it possible to save this virtual machine with the limitation could only ride a maximum 1 TB drive on the device?

    Thanks in advance

    Brendan

    vDR is not an appropriate tool for the backup of a disk which is that great. Even though the limit is 1 TB in a practice 1 TB is not a good choice as a backup destination disk. Less than 500 GB is a more appropriate choice and multiple 2 or 300 GB even better. If something were to happen that requires a vDR re cataloging a 1 TB drive that it can take days. I can tell you that re cataloging is not uncommon. In the meantime, you have no access to vDR. No replacement takes place. Long and short - find another tool to back up this disk.

  • PDF file generated from Reporting SERVICES hangs when opened in Adobe reader 11 and saved as with "optimized for fast web view."

    Large pdf (over 1000 pages) generated files form SSRS crashes when opened in Adobe reader 11 and saved as with "Optimized for fast web view" activated. This saves fine with disabling this option. However, our customers are not ready to accept this solution because they do not want to change any settings. Please suggest if we should create a ticket with microsoft for SSRS allow the generation of pdf quick display of Web pages or is it an option in Adobe to fix this problem without changing the settings.

    The SSRS file has Fast Web View: 'No' and that's how Microsoft SSRS generates these files.

    Thank you for the complete maxwyss response

    As you have indicated, the PDF SSRS seems to have some elements that are quite similar to be supported for fast web view.

    We asked customers to disable the fast web view, but the customer is big enough to make a change individually on their machines and so were looking for a solution.

    I saw in several forums and a few discussions here as well as disable the fast web view option works for pdf fails.

    Which was just wondering if its known that multiple PDFs genarted by third parties may have problems with the optimization, the Save as optimized for fast web view could be disabled by default installation of acrobat reader rather than be enabled by default

    Thanks again for the reply!

    PS: links indicating similar problems

    https://forums.Adobe.com/message/7965091#7965091

    https://forums.Adobe.com/thread/1456971

    How to fix Adobe Acrobat "save under" error - Digital Factory tool blog

    https://social.msdn.Microsoft.com/forums/SQLServer/en-us/63cf1325-2054-4ef1-9c5d-631da6a30 cfc/file-size-of-exported-pdfs? Forum = sqlreportingservices

  • What is the file brayhs with size zero?

    Original title: brayhs

    What is the file brayhs with size zero?
    How can I clean my system (windows Server 2003) this?

    Run a full scan of the system and set your PC to show hidden and system files and the folder and check if there is any suspicious element or just try to delete.

  • Read byte with a value up to 127 lire byte with an ASCII value greater than 7F (127 dec)

    Hello

    I have to read a byte with a value greater than 127, Labview turn 27.

    In help I saw that Labview provides a description of ASCII that pour values ranging up to ' 127.

    What do I need to do?

    LabVIEW 6.1

    Windows XP

    Hello

    I want to read a byte with a maximum value of 127, but Labiew reurn arround 27 value

    How do I do?

    Rigid wrote:

    Thanks for your help. I'm not changing lyke I understand (my English is poor quiet...)

    I have another program that communicate with the instrument. I know byte (6) must be greater than 18 (greater than 7F actually).

    But with Labview, I'm only 18.

    While it might be higher than 18 x, an I8 is signed, and therefore it cannot be greater than x7F - it has a range of-128 to 127. A U8 is not signed, and it's why he has a range from 0 to xFF. However, x 18 is the same if you treat as signed or not signed. I don't see how LabVIEW can read a wrong value on the serial port. Are you sure you're looking at the correct byte? Your code shows that you split the chain twice. Are you sure that you do this properly?

    Given that you use on Windows you can recheck the chain received using PortMon. Allows you to see what is actually received by the driver for the serial port on Windows.

    P.S. I actually meant the whole byte function.

  • I am running windows vista on the PC of my church and have inserted a USB stick with a MP4 file on it, but I can not read this file.

    I am running windows vista on the PC of my church and have inserted a USB stick with a MP4 file on it, but I can not read this file. Can I get help?

    I created a video for our Church on a desktop of Windows 7 through Pinnacle Studio 14 (editor) and registered as a .mp4 file. I then put it on a flash drive and put the flash drive in the computer of the Church, that is running Windows Vista, and the file will not play. Please provide help quickly!

    -Corey

    You need a media player that is compatible with .mp4 files.

    The following preferential ticket should solve your dilemma.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    VLC Media Player
    http://www.filehippo.com/download_vlc/
    (works on XP/Vista/7)

  • need help with reading ZIP files.

    Dear windows team

    I am self-taught on the computer and I am a 55yo.

    I have Aproblem... .i don't know how to read ZIP files... .everytime I try to get to the one just saying my computer doed not support... I tried to download a free access, but then nothing happens...: (.. .the it in is the same with RAR files when I want to watch some movies.. .please could you help me should I download for free on internet... .i understand if you can't help to be honest I'm computer illiterate)

    Kind regards...

    Mario

    Hello

    In the case of zip files, you can right and select extract files to get all the files extracted using File Explorer. For RAR files, you can try 7 - zip:

    http://www.7-zip.org/download.html

    Hope that answers your query :)

  • I've just updated my LR, but still can not read the new RAW files of my brand new Sony a6300. said 'impossible to read these files' is Adobe should update it program with new firmware to manage these new folders? Or something escapes me?

    I've just updated my LR, but still can not read the new RAW files of my brand new Sony a6300. said 'impossible to read these files' is Adobe should update it program with new firmware to manage these new folders? Or something escapes me?

    You updated Lightroom to version 6.5? This is the version you need. What is the exact wording of the message you receive?

  • With previous versions, I could press control (mac) and click on a layer, and he would choose this graph, what form it was. Then I could go to image-culture and reframe the entire file down to that size. Now, this feature is missing. What is the new way t

    With previous versions, I could press control (mac) and click on a layer, and he would choose this graph, what form it was. Then I could go to image-culture and reframe the entire file down to that size. Now, this feature is missing. What is the new way to do this?

    This is the command key, not the control key for a Mac that you use on the layer.

    Gene

Maybe you are looking for