Hi I need to read the data in vaiables local file delimited using the utl_file package «»


Hi all

I want to read data from a .csv file which is ',' delimited in a local variable that is different from a plsql stored procedure so that I can insert into the table.

I use this way to read data...

--------------------------------------------------------------------------------

-get the position of ',' (comma) in csv file

--------------------------------------------------------------------------------

l_c1: = INSTR (l_in_file, ',', 1, 1);

l_c2: = INSTR (l_in_file, ',', 1, 2);

l_c3: = INSTR (l_in_file, ',', 1, 3);

l_c4: = INSTR (l_in_file, ',', 1, 4);

l_c5: = INSTR (l_in_file, ',', 1, 5);

l_c6: = INSTR (l_in_file, ',', 1, 6);

l_c7: = INSTR (l_in_file, ',', 1, 7);

l_c8: = INSTR (l_in_file, ',', 1, 8);

l_c9: = INSTR (l_in_file, ',', 1, 9);

l_c10: = INSTR (l_in_file, ',', 1, 10);

--------------------------------------------------------------------------------
-pull data into local variables
--------------------------------------------------------------------------------
l_0003: = SUBSTR (l_in_file, l_c2 + 1, l_c3-(l_c2 + 1));

l_0004: = SUBSTR (l_in_file, l_c3 + 1, l_c4-(l_c3 + 1));

l_0005: = SUBSTR (l_in_file, l_c4 + 1, l_c5-(l_c4 + 1));

l_0006: = SUBSTR (l_in_file, l_c5 + 1, l_c6-(l_c5 + 1));

l_0007: = SUBSTR (l_in_file, l_c6 + 1, l_c7-(l_c6 + 1));
l_0007: = To_Char (To_Date (l_bdate_0007, "mm/dd/yyyy '"), 'yyyy-mm-dd');

l_0008: = SUBSTR (l_in_file, l_c7 + 1, l_c8-(l_c7 + 1));

l_0009: = SUBSTR (l_in_file, l_c8 + 1, l_c9-(l_c8 + 1));

l_0016: = SUBSTR (l_in_file, l_c9 + 1, l_c10-(l_c9 + 1));
l_0016: = To_Char (To_Date (l_eff_dt_0016, "mm/dd/yyyy '"), 'yyyy-mm-dd');

I need to find an alternative way to reduce the length of the Code.

Any Suggestion please!

Hello

Please see the query below...

SELECT RTRIM (REGEXP_SUBSTR ('John, 100, Manager, 26000', ' [^,] *,', 1, 1), ',') AS part_1

, RTRIM (REGEXP_SUBSTR ('John, 100, Manager, 26000', ' [^,] *,', 1, 2), ',') AS part_2

, RTRIM (REGEXP_SUBSTR ('John, 100, Manager, 26000', ' [^,] *,', 1, 3), ',') AS part_3

, LTRIM (REGEXP_SUBSTR ('John, 100, Manager, 26000', ', [^,] *', 1, 3), ',') AS part_4

DOUBLE;

Tags: Database

Similar Questions

  • camera raw 7.2 does not settle in CS5.5, but need to read the P7700 nrw files.

    camera raw 7.2 does not settle in CS5.5, but need to read the P7700 nrw files. Not to mention that DNG Converter, what can I do to use the files directly?

    Your next option is upgraded photoshop. If you don't handle the full version (less than $20 / month) you get elements, it uses the latest version of camera raw, but I think it's a lighter version but.

  • Export data in a flat file without use of FL

    Hello

    I'm looking for options where I can export data into a flat file without using a FL (line Layout) i.e., using only the App Engine.

    Please share your experience if you did something like this

    Thank you

    A simple way to export any folder (table/view) to a csv gall, is to create a set of lines and loops through all fields of record like below example code

    Local Rowset &RS;
    Local Record &Rec;
    Local File &MYFILE;
    Local string &FileName, &strRecName, &Line, &Seperator, &Value;
    Local number &numRow, &numField;
    
    &FileName = "c:\temp\test.csv";
    &strRecName = "PSOPRDEFN";
    &Seperator = ";";
    
    &RS = CreateRowset(@("Record." | &strRecName));
    &RS.Fill();
    
    &MYFILE = GetFile(&FileName, "W", %FilePath_Absolute);
    
    If &MYFILE.IsOpen Then
    
       For &numRow = 1 To &RS.ActiveRowCount
          &Rec = &RS(&numRow).GetRecord(@("RECORD." | &strRecName));
    
          For &numField = 1 To &Rec.FieldCount
             &Value = String(&Rec.GetField(&numField).Value);
             If &numField = 1 Then
                &Line = &Value;
             Else
                &Line = &Line | &Seperator | &Value;
             End-If;
    
          End-For;
          &MYFILE.WriteLine(&Line);
       End-For;
    
    End-If;
    
    &MYFILE.Close(); 
    

    You can of course create an application for generic class call this piece of code.

    It will be useful.

    Note:
    Do not complain to me ;) on performance issues

  • How to implement the reading of data from a matte file on a cRIO?

    Hi all!

    I'm still not sure, it is plausible, but I'll ask rather before you begin complicating. So far, I found no useful information on reading in the data to a device of RT from a file (type of a simulation test - data is simulated).

    I have the MatLab plugin that allows the storage of data read a MAT file, which has a number of columns that represent the different signals and lines representing the samples at a time (depending on the time of the sample - sample every time has its own line of signal data).

    I have no idea how to implement this at cRIO.

    The idea is:

    I have some algorithms running on the controller of RIO in a timed loop. As the entries of these algorithms I need to access each of the values of columns in the row, which is the time of the sample (sort of a time series - without written actual times).

    I am fairly new to RT and LV development, so any help would be appreciated.

    Thank you

    Luka

    Dear Luka!

    I think the reading of all the samples in a single channel is exactly what you need here, because reading the files may take some time and is not deterministic, so it is best to read all the data in memory (or if this is not feasible due to problems of size, fairly large pieces may be sufficient). The table read can be provided and then in the loop simulating outings, something like this:

    I used here separate channels so it's more graphic, but you can build all the channels in a 2D array and array index corresponding to the samples fom 1 who. You can also use for loops with indexing as tunnels are setup and then you won't need the index functions and the number of iterations is also set automatically, but you have to take care of synchronization settings.

    Best regards:

    Andrew Valko

    National Instruments

  • I need to read a pdf document or a web page using the Narrator

    Original title:

    Narrator

    Y at - it a Update for Narrator to 8 X 64 Windows because I can't not to read anything! It will say my main features or open the window on or off, turn off, but it will not READ! very frustrating. I'm not blind, but my eyesight is poor, so I thought I'd give it a try, but I can't read something important. It will read a header or strikes (that I don't need) I need to read a pdf document or web page.

    Hello Tracy,.

    Please, press the logo Windows + ENTER key to start Narrator, and then minimize windows accordingly. Done this, open the page/document you want to read, and then press SHIFT CAPS LOCK + H.

    It reads the current page/document? You use Internet Explorer?

    Also make sure that other settings in the Narrator is correct.

    Reference:

    http://Windows.Microsoft.com/en-us/Windows/hear-text-read-aloud-Narrator#1TC=Windows-8

    Please let us know the status of the issue.

  • need to read the microsoft article 871122

    Help me find a way here to read the article 871122

    Hi, please describe in more detail exactly what you're trying to do. Are you referring to the article 871122 number support? http://support.Microsoft.com/kb/871122 here is the link for it.

  • Problem loading swf which reads data from a local file

    Hello

    Using flex with an online project, I load a swf file, which reads data in a xml file (it works fine if I open it with flash player)

    I do a very simple test:

    " < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML "
    layout = "absolute".
    minWidth = "955" = "600" minHeight
    >
    < mx:SWFLoader id = "swfloader" source="data/player.swf"/ >
    < / mx:Application >

    Result is that player.swf is unable to read the xml file (error: #2044 Error: ioError unsupported: text = Error #2032: error of flow.) URL: enonce.xml).

    I do the same test with a project of AIR, and it works very well!

    This also works if I put the xml file directly to the same level as my compiled (in bin-debug for example) application.

    I think it's a path problem, but I do not know how to configure it.

    Is there a way to solve the problem?

    Thank you very much!

    Olivier

    You need to change the code in the SWF file you load.  If the SWF file is not

    properly designed, it can not be loaded into other SWFs.

  • Need to read a 30, 1.5 a analog input using a NOR-9205

    Problem: I need to read two analog inputs with good resolution using a C-Series card. The two beaches of signal are 0-30 V @ 1.5 and 0-5 V (not sure of the current). I need to be able to read the signal 5V with a precision of mV (or 16-bit resolution).

    I looked at the module-9221, which works very well with the 30V, signal, but does not have enough resolution for the 5V signal. The 9221 is 12 bits on the beach of 60V.

    I looked at the NOR-9205, which works very well with the 5V signal, but it cannot process the higher V 60 signal.

    If a voltage divider circuit comes to mind, but has anyone found a good solution to this (other than to get both modules)?

    Well, the current should not question.  The entrance of the analog device (ideally) should draw no current and everything running on the source will cross the UUT.

    A 4:1 voltage divider should evolve the signal to 9205 AI as long as you do not violate the absolute maximum voltage between a pin of the device and the Earth.

  • Having a problem to recognize the file using the utl_file package...

    Hello

    I use utl_file utility to read the CSV file, utl_file.fopen function is useed to open the file. The fopen function has three input parameters, the second parameter is the name of the file. My problem is that I need to read file on a daily basis. The file name will be like:-DDMMYYYYHHMISS. Last six characters are for the hour minute second generational file. If the name has only DDMMYYYY then I can give the name of file as TO_CHAR(SYADATE,'DDMMYYYY'), for an individual the same date throughout the day. But the hours, minutes and seconds will be time when the file is generated, it can be different for different days. In this case how can I normalize the value for the filename parameter in the function fopen.

    Thanks in advance.

    Similar to the jeenesh solution:

    declare
     fexists boolean;
     fname varchar2(20) := to_char(trunc(sysdate),'DDMMRRRR');
     ......
    begin
     . ...
       for i in 1..24*3600 loop
         utl_file.fgetattr(location,filename || to_char(to_date(i-1,'sssss'),'HHMISS'),fexists,file_length,block_size);
         if fexists then fname = fname || to_char(to_date(i-1,'sssss'),'HHMISS'); exit; end
      end loop;
    .... --- now you can open the file with above found filename
    
    end;
    /
    
  • run the UTL_FILE package

    declare

    utl_file.file_type F1.
    Start

    F1: is UTL_FILE.fopen ('UTL1', 'example1.txt', 'w');.

    UTL_FILE.put_line (F1, 'hello');
    UTL_FILE.put_line (F1, 'welcome');
    UTL_FILE.put_line (f1, "this is the example to use utl_file package system");
    end;

    After the execution of this file is created with the specified name in the specified location.
    but the text is not inserted into the file.
    What is the reason and how can I solve this problem?

    You forgot to fclose

  • I have Acrobat 10 and became error update messages that I've finally done what Adobe recommended and uninstalled Acrobat.  Now, I can not re-install the program and get a number of different error messages.  Help I need to read the pdf docs!

    I have Acrobat 10 (10.1.9) who came in the Creative Suite CS5.  I received many messages about updates failed so finally did what was recommended by Adobe and uninstalled the program.  Now I can not re - install.  Here are the error messages I receive.  Help!

    Exit code: 6

    Please see the faults and warnings below for troubleshooting. For example, ERROR: DW050... WARNING: DW065, DW066...

    -------------------------------------- Summary --------------------------------------

    -0 fatal Error (s), 3 (s), 2 warning (s)

    WARNING: DW066: OS requirements not met for {AC76BA86-1033-F400-7760-000000000005}

    WARNING: DW065: display the requirements not met for {53CF3920-648B-4F99-8D05-6A6C5298F57B}

    -Payload: {AC76BA86-1033-F400-7760-000000000005} Acrobat Professional 10.0.0.0.

    : Error 1328.Error applying the fix to the C:\Config.Msi\PTDB05.tmp file.  It has probably been updated by other means, and can no longer be modified by this patch.  For more information, contact your patch vendor.

    ERROR: Install payload MSI failed with the error: - 1603 Fatal error during installation.

    MSI error message: error 1328.Error application of the fix to the C:\Config.Msi\PTDB05.tmp file.  It has probably been updated by other means, and can no longer be modified by this patch.  For more information, contact your patch vendor.

    ERROR: DW050: payload following errors were found during the installation:

    ERROR: DW050:-Acrobat Professional: installation failed

    The installation must be done through the CS process, not a straight line installation and activation as a stand-alone product.

  • I need to read the MouseMove event while dragging a component

    I have a MousDown event for my component that does the following.

    public void MouseDownHandler(event:MouseEvent):void {}

    systemManager.addEventListener (MouseEvent.Mouse_Up, MouseUpHandler);

    systemManager.addEventListener (MouseEvent.Mouse_Move, OnMouseMoveHandler);

    startDrag();

    Do things.

    function MouseMoveHandler(event:MouseEvent):void {}

    Do things.

    }

    function MouseUpHandler(event:MouseEvent):void {}

    Do things.

    stopDrag();

    }

    }

    The function MouseUpHandler is well-executed and everything works.  I added a breakpoint in the OnMouseMoveHandler, and I see that the program never reaches her.  It almost seems as if the MouseMove events cannot be distributed during a move.  Any suggestions?

    We certainly get mousemove even when the button is pressed.  Something is not.  Try a new project and the simple test case.

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc..

    Blog: http://blogs.adobe.com/aharui

  • How to get data from an Excel file exist using report generation tools

    I try to use the Excel vi get the data of the report generation tool, but I can't understand how to activate a path can be explored in the right type for the VI.  I tried to use the new Report.vi, but this does not work unless you use a template.  It will not open an existing excel file and make an open report to extract data from.

    Essentially, I have a bunch of excel files that have data in them, and I want a VI allows to analyze the data.  I'm going to pull in all the data directly from the excel file so I don't have to reproscess them all in text so I can use the more standard datasheet live but to convert even the excel file programtically in labview I still need to be able to open the excel file and get the data?

    I found my problem.  It turns out that only not to have had a problem with the tool box new report vi.  I had accidentally wired an input control of path of folder instead of an input control of path of file to it.  Changing the file type took care of her and I was able to access excel files, I tried using the new report VI to extract the file, and Excel Get Data to extract the data.

  • Help about the utl_file package

    Hi all
    I'm new on utl_file

    I created a directory

    Create directory LOGDIR AS 'G:\logdir\ '.

    My dbuser with DBA privileges.

    Here is my code
    DECLARE
    vDATA  VARCHAR2(4000);
    vInHandle  utl_file.file_type;
    BEGIN
      vInHandle := utl_file.fopen('LOGDIR', 'TEST.TXT', 'R');
    UTL_FILE.GET_LINE(vInHandle,vDATA,256);
     
    dbms_output.put_line(vDATA);
      
    END ;


    but when i run this code it gives me

    Error on line 0
    DECLARE
    vDATA  VARCHAR2(4000);
    vInHandle  utl_file.file_type;
    vOutHandle ut

    ORA-29283: invalid file operation
    ORA-06512: at "SYS.UTL_FILE", line 475
    ORA-29283: invalid file operation
    ORA-06512: at line 6
    Please help me

    This error indicates usually that there is a problem, see the file. Either the directory on the operating system permissions are incorrect for oracle to be able to see the file or the file does not exist or, if you are using a unix database server then the file names will be case-sensitive. I assume that your oracle server is not unix that you have specified a windows style path in your directory. (You obviously realize that UTL_FILE can only access the database server file system and local client filesystems not?)

  • Need help with TS to read the list of variables and/or LV

    Hello

    I use Labview adapter in Teststand to open WinIDEA and read the values of the variables. Basically LV lib files are used to read the value of the variable at run time, and returns the value of the variable. Contribution to this labview function i.e. variable name string and output type cluster.

    I need to read the list of variables and compare it to the value limits for each variable. I perhaps need to read at least 50 to 60 variables in one step if possible or a variable at a time in a loop. I want to add these variables in a txt file with the limits and read of Teststand as a string array and compare the result. In this way is easy to add or remove variables from the list and therefore their expected value. I tried to use the shipper of the property, but there need a stage name or local/global variable.

    Another way is to add the code in labview for comparison of variables value read, then I lose teststand power and flexibility.

    I am struggling to find the best way to achieve this. Any ideas?

    I would like it.  Basically, you have a file limit with 2 data tables.  A table contains your variables and the other your limits.  Then you wrap on a test of a string value.

    Let me know if you have any questions.

Maybe you are looking for

  • Open a spam of FedEx, clicked on the link

    I ordered a few packages for Christmas so I opened the email and clicked on the tracking number and heard that it is a scam of current viruses. I have a MacBook pro, did not download anything, but my computer will be at risk? What I'd do here?

  • Event navigation response is Slow

    Hello I have download a demo interface to illustrate a problem I encounter. I use a control tab and 'Buttons OK' to change the tabs. The appearance of the 'OK' button is changed by pasting images of Microsoft Visio, through the button right click-> A

  • Restore disks lost recovery partition &amp; Windows XP

    If I have two M series Thinkcentres with compatible machine types. Can I use a set of the first Thinkcentre restore disks to install Windows XP on a second Thinkcentre of the factory where the disk partition recovery and install has become corrupted?

  • How can I make best use of Windows XP wireless connect?

    This may seem Basic, but I want to understand all aspects of the configuration of my PC of course. As long as I connected to the wireless Web, I used a software provided by Netgear, that makes the wireless adapter. When I moved into an apartment, the

  • View the folders and files together in alphabetical order rather than the records first, then files

    It seems impossible to display files and folders together in alphabetical order.  Instead I see files first and then the files that I often (not always) want I have sometimes seen them together but have no idea how this happens. Ferrière