Utl_file how to start reading from a certain position?

Hi all,
i'm currently using utl_file to read a text file and import to db. i have managed to do it. however i would like to avoid reading the first line as it is the header. i would also like to avoid the last line as it is the footer.
how do i use the function of get line to start reading at a certain position? i am also able to get the length but i do not know how to make it start reading from a certain position.
the length of the first line will always be 9 and length for the last line would be 51.
here's my code so far:
set serveroutput on
declare
vSFile   utl_file.file_type;
vNewLine VARCHAR2(4000);
file_name VARCHAR2(200) := 'read.txt';
v_exist     BOOLEAN;
v_length number;
blocksize   NUMBER;
temp_value varchar2 (4000);
BEGIN
  vSFile := utl_file.fopen('MYDIR', file_name,'r');
  IF utl_file.is_open(vSFile) THEN
    LOOP
      BEGIN
        utl_file.get_line(vSFile, vNewLine);
        IF vNewLine IS NULL THEN
          EXIT;
        END IF;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
          EXIT;
      END;
    END LOOP;
    UTL_FILE.FGETATTR('MYDIR',file_name,v_exist,v_length,blocksize);
    dbms_output.put_line(v_length);
    COMMIT;
  END IF;
  utl_file.fclose(vSFile);
END read_demo;

Hi,
utl_file has an fseek procedure for moving the file pointer around in a file, either absolute or relative number of bytes.
It's in the documentation, I'm surprised you didn't see it there when you looked before going to the hassle of asking us a question.
Andre

Similar Messages

  • How to remove iPhone from a certain computer

    How to remove iPhone from a certain computer along with it's ID to allow another phone to use the comp soley.

    You do not need to do anything.
    Simply stop syncing the iphone to the computer and begin syncing the new iphone to the computer.

  • How to Start report from pl sql procedure

    I need to create a procedure which runs report and email report output to specified email adress.
    I don't know how to start report from pl/sql. Any help will be appreciated.

    I want to start oracle report from plsql procedure. Is there any OS system command I can use or any other method? My database is installed on windows 2000 machine.

  • FaceTime and iChat?..how to start chat from my iPad to a Mac on iChat?

    how to start chat from my iPad to a Mac on iChat?

    Yes, that is exactly what I mean.
    The iPad can only do FaceTime and FaceTime is NOT linked (compatible) with iChat.
    If your parents have an older Mac, or are only on Leopard, Tiger or such, you could use Skype.
    It's free. The video quality isn't quite as good, but it does work. Your parents would need the Skype program installed on their Mac. You can download the free Skype for iPad.

  • I forgot what was the shortcut how to download music from a certain website

    I forgot what was the shortcut on how to download music from a certain website. I only remembered open a new tab, put the url and press command+..... i forgot the other things =((

    Are you using Mountain Lion? And are you using Safari?
    There used to be this thing called the Activity Window in Safari that would make it easy to show the files (like audio files) in a web page. That doesn't exist any more but in the Develop Menu there is Show Page Resources that can do the same thing.
    Audio Hijack Rogue Amoeba | Audio Hijack Pro: Record Any Audio On Mac OS X will let you "record" audio from a web page.

  • How can start service from the spfile, on  Windows 2003,

    On Windows 2003, how can start service from the spfile?
    connect to the database as sysdba and startup will start from the spfile.
    Once I use wondows Service for shutting down and startup datbase it start from the pfile.
    Which defeat my ability to change parameters at the system level.

    Hi,
    I'm not sure, but maybe your windows Instance service was created with
    C:\> oradim -new -sid <SID> -startmode m -pfile C:\oracle\product\10.1.0\admin\pfile\init.ora
    then, you need edit this service with command like below:
    C:\> oradim -EDIT -SID <SID> -spfile C:\oracle\product\10.1.0\admin\spfile<SID>.ora
    Take a look on this link before make any changes:
    http://www.stanford.edu/dept/itss/docs/oracle/10g/win.101/b10113/create.htm#i1006533
    Cheers

  • How can I read from a file line by line?

    Hi!
    Could someone post some code or explain how can I read from a file, and want I to read a line each time. How can I go to line number N?
    Thanks

    hi,
    u can try this:
    try     {
          // open text file
          BufferedReader in = new BufferedReader(new FileReader(fileName));
          String line=in.readLine();
          while((line=in.readLine()) != null) {
          System.out.println(line);
          }The go to line number N i m not so sure.
    Cheers
    Jerry

  • How to read from a certain location is a file?

    hi! i am new to programing and i have a problems abt reading from a file. i have write the following to a file using FmtFile :
    10 (a numbers)
    name,phone,product (some strings)
    9 (a numbers)
    when i user ScanFile to read the second number(9 in the above example), i got a wrong value. the command i use is:
    ScanFile (filehandle, "%d", &number1);
    ScanFile (filehandle, "%s[t44]%s[t44]%s",name, phone product);
    ScanFile (filehandle, "%d", &number2);
    number1 and number 2 are integers and name, phone and product are char arrays.
    can anyone tell me where have i gone wrong? or maybe someone can tell me how can i read the 2nd number without reading the 1st number
    and the strings.

    Let's look at your file: if I correctly interpret your question, one row in it should like like this:
    10,name,phone,product,9
    In this case you could use the following formatting string to read all data from the string:
    "%d[x]%s[xt44]%s[xt44]%s[xt44]%d"
    [x] means to discard terminator, in order to read from strings, for example, "name" and not "name,". It's important in this case to put ALL field separators.
    Maybe your problem is that in the file you don't have separators between strings and numbers: in this case the last "%s" should read the '9' inside the last string and the subsequent "%d" matches with incorrect area in the file (end-of-line or next row).
    Hope this help
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How to Start/Stop from Server Manager

    Hello,
    I am trying to figure out how to start/stop/restart my coldfusion servers from server manager.  I have seen the instruction at this link:
    http://help.adobe.com/en_US/ColdFusion/9.0/Admin/WSfd7453be0f56bba4-2a6b48f122a6582c7f-7ff e.html
    However it mentions "place the jrunappstartup.war file under the directory <CF_Home>/runtime/servers/admin"
    I do not know where to get this file from.  Please help!
    I am running ColdFusion standalone.
    Any help is much appreciated,
    Thanks,
    David

    An update to eariler posting. Configure CF9 Enterprise multiserver.
    Likewise unable to find jrunappstartup.war file mentioned.
    If I follow the instructions and try configure the SM Start Stop Details the Start Stop Restart
    does not become an highlighted option.
    Here are a couple screen cuts for interested readers-
    Start Stop Details (are these correct Jrun items to fill in?):
    Unable to restart from SM:
    Regards, Carl.

  • Data reading and writing problem? how to set " Read from Measurment File express.vi​" 's readout datasize?

    Dear all,
    I want to use Labview to process a data.
    Now I have a array in a text file.
    this array is very very big. which is at least row*col = 6 * 100000;
    the column size always 6,
    but the row size is ramdom, some times is very big, like bigger than 65535,
    when I use "read from measurement file express.vi" to read this file, the array I could get always 6*5339, I don't know why. the column size is always 5339.
    and then I delete the 1st row of the array and then write into a txt file via "write measurement file express. vi", it takes a very long time. almost computer has no response. after a while, no file was creat to record the data.
    is there an efficient way to process such big data file and store the processed file into a new file
    thank you very much
    Jack
    Message Edited by weichengatech on 03-09-2006 12:00 AM

    Hello,
    There’s no real efficient way to read the file if you don’t
    know exactly how many rows of data you have. 
    Your going to just have to read a row at a time and add the results to
    the end of an array (granted for the clever programmers there are some more
    efficient ways to do this than just with ‘build array’).  I would start by asking you how much
    information you know about the file and what the exact structure of it is (i.e.
    is it a binary file, a tab delimited file, or a LVM file)?  Could you provide a screenshot of the code
    you are running? If you provide a little more information on the file structure
    we might be able to contribute some additional information.
    Look forward to hearing back from you-
    Travis M
    LabVIEW R&D
    National Instruments

  • How to start a systemd with certain configuration options?

    Hello,
    I do not understand what wiki page at arch that can help me to understand how I can start a daemon with certain configuration options. I know I can start with
    # systemctl enable unit
    , but for example, if I whanted to start "xboxdrv" with the option [--mimic-xpad-wireless --silent], or any other custom options I might need. I presume it can be done simple by dropping a .conf file somewhere, but I do not follow what wiki page that adress this - if it at all is possible?
    Regards
    Martin

    Hello,
    I followed the drop in option now in https://wiki.archlinux.org/index.php/Sy … n_snippets
    I tried to copy the whole xboxdrv.service and replace the ExecStart, and also only with ExecStart, like this:
    [Service]
    ExecStart=
    ExecStart= ExecStart = /usr/bin/xboxdrv -D -c /etc/default/xboxdrv --mimic-xpad-wireless --silent
    The drop in examples above is in: /etc/systemd/system/xboxdrv.service.d/override.conf
    Reatarting
    I then made sure the new .conf file was loaded by:
    # systemctl daemon-reload
    # systemctl restart xboxdrv
    # system status xboxdrv
    Result
    In both cases, the service fails to restart and I recive this error
    xboxdrv.service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
    Anyone know how I can start "xboxdrv" with my custom options "--mimic-xpad-wireless --silent" using this drop in function for systemd?
    Regards
    Martin
    Last edited by onslow77 (2015-02-01 18:27:31)

  • How to start KDE4 from slim?

    Hi Everybody
    I have slim as the LogIn manager.
    Also kde3 and openbox as my standard DE
    Now I wanted to give KDE4 a try.
    But how can I start it from slim?
    startkde of course starts my KDE3 from /opt/kde.
    And another startkde in /usr/bin doesnt exist.

    http://wiki.archlinux.org/index.php/SLIM
    Did using exec startkde not work?
    Ah, wait. Are you using both KDE3 and KDE4? (You should have said so more clearly)
    I would suggest typing the full pathname to the startkde you want.
    Ahead of time, if you're using the official repos, I would switch to KDEmod if only for compatibility between KDE3 and KDE4. There's been problems I believe with using both from the official repos. KDEmod3 and KDEmod4 work fine together. If you really don't like KDEmod, a chroot might be the only solution.
    Myself though, I wouldn't even try running both - no need, unless you for some reason truly need both at once. For just testing, backing up your .kde config folder and then removing KDE3 and getting 4 should be enough - you can go back if you want after.
    Last edited by Ranguvar (2009-01-31 23:10:26)

  • How to start up from 2nd mac? Need to un-trash deleted files...

    I accidentally put in trash and emptied a folder with weeks of work and I have to do EVERYTHING POSSIBLE get it back. The Mac shops here in L.A. are all minimum 5-7 days repair turnaround - that means I can't work for five days and they may not be able salvage anything anyway.
    Immediately upon realizing what I did, I stopped writing anything to the harddrive - so basically I can't use my computer.
    I've found Norton UnErase is useless unless you had FileSaver previously installed and running regular backups.
    I don't know anyone local with a Mac but I could take my G3 to work, try to start it with my G5 there and run a shareware app called DataRecoveryTool 2.0.3. So far installing DRT on one of my 3 partitions hasn't worked - it doesn't recognize or list any volumes to recover..
    Trouble is, I don't know how to start one Mac from another. I just need an ethernet cable and some keyboard commands, right? I've seen it done long ago.. My cousin in Pasadena has a Powerbook - can I do it with that? What do I need to bring with me?
    Would appreciate all help that would lead me towards re-gaining my data. If you're in LA (SFValley) and have experience - I will pay you to help me! TIA
    BW G3 400   Mac OS 9.2.x  

    Hi, 150mph -
    Firewire Target Disk Mode could achieve what you want - except that the B&W G3 models can not be the Target machine in such a setup, although they can be the Host machine.
    Data Recovery may work only on a disk basis, not a volume basis. Here's a couple of other utilities to try, ones designed to recover data from a mechanically sound drive which refuses to mount.
    Data Rescue
    Virtual Lab
    You may need to pull the drive from the B&W G3 and place it in a multi-drive capable Mac, then use a data recovery utility on the B&W's drive while that other Mac is booted to its normal drive.

  • How to Start Skype from the background from command line?

    Hello. 
    My window manager is Evilwm and I am running Skype.  If I close the Skype window (the one w/ my buddies listed) the window closes but Skype is still running in memory.  On another window manager like Openbox a small Skype icon sits in the taskbar as long as it is running.  If I want to start Skype to see who is online I simply click the icon in the taskbar.   
    Now, the question is...How can I start skype from the command line while it is running in the background?
    Evilwm doesn't have any taskbar or tray thingie...
    Any ideas? 
    Any advice is appreciated! 
    Thanks!
    nedson :?:

    Thats what I thought...
    What I wanted to do was call Skype from memory.  Under Evilwm I can close a window with ctrl-alt-x (using a hacked version of EvilWm) .  After cloasing the window with this method, skype is still running in memory (I can see it when running ps aux).  How can I call it out of memory?  I don't want to stop the program, start it back up and re login.  I just simply want to call it from the background...
    Any ideas?
    nedson

  • How to start video from specific time

    hey frnds,
    how can we start video from given time in osmf player and also how to ad cue point to stop it

    I'd like to do something similar , i.e load a streaming resource but have it play from time "n" rather than time 0.
    I looked at clipStart, but that seems to truncate the video to start from time n, in other words when I use clipStart, I dont seem to be able to seek to a point between 0 and "n"
    Using play() and then seek() to "n", seems to work but causes it to buffer twice, which looks really bad to a user who just wants to start the video from time "n".
    Is there another way to achieve this?
    Thanks,
    - abey

Maybe you are looking for

  • Is my Zen Touch DRM compliant/compatib

    Hi All, I've just got a Zen Touch 40gb.Apologies for such a dumb question,but this mp3 malarkey is new to me! Can you tell me if it is DRM compliant (as Creative claim in the online catalogue). I'm just wondering if anybody can tell me which music do

  • RE:Reading SOAP Element in java

    Hi All, I am calling one web service in java the output of web service is SOAP Element when i tried to print that it gave the follwing o/p <CheckKeyActivationResult xmlns="http://tempuri.org/"> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www

  • Query regarding the fields details in particular form for all the users in

    Dear All,               I have one query regarding the fields details in particular form for all the users in company. Let take an exapmle if i had created Purchase Order having fields in content tab as 1.Item No. 2.Quantity 3.Unit Proce   4.Total  

  • ADF BC : Problem in Inserting a Master - Detail Record

    Hi, I am new to ADF Business Components. I am into a project where i use only the ADF BC as ORM/DB Operations and for the front end I use some other framework. The Problem is. I have two entity objects and a ViewLink between them. [Relation between "

  • Can I stay connected even with the laptop closed?

    Is it possible to close the top of the laptop, but still stay connected to the internet? If so, how? Thank you!