How to use Substr & Instr to get data from a file

hi i have a Scenario
i am getting a file like this
1,20,ram,sales
i am getting a file like this data as a column
i want to split this data in 4 different column like
1     20      ram     Sales

Hi,
this query will help you.
select
     SUBSTR(C1,0,INSTR(C1,',')-1),
     SUBSTR(C1,INSTR(C1,',')+1,INSTR(C1,',',1,2)-INSTR(C1,',',1,1)-1),
     SUBSTR(C1,INSTR(C1,',',1,2)+1,INSTR(C1,',',1,3)-INSTR(C1,',',1,2)-1),
     SUBSTR(C1,INSTR(C1,',',1,3)+1,INSTR(C1,',',1,4)-INSTR(C1,',',1,3)-1),
     SUBSTR(C1,INSTR(C1,',',1,3)+1)
from (
     select '1,20,ram,sales' C1 from dual
remember that a comma isn't really safe as field separator
Message was edited by: DecaXD

Similar Messages

  • How to use JDBC iView to get data from MSSQL

    Hi Guru,
    I just try to follow the Demo (from SDN) to use JDBC iView. In the step of selecting query or existing function, I choose the query option to broswer the table. But the system is not display any tables. It just keep on displaying 'Loading ...'. Is there anything wrong with that?
    Thanks for your help,
    Bo

    Hi Bo,
    I got the same problem with your, do you know how to fix the problem?
    Thanks,
    Ku

  • Report question: how to use external table to bring data from excel file?

    i need to import excel data into oracle report, how to do that? thanks.

    Hi... What is the error message you get when using external tables?
    You must create a control center connection in the Connection Explorer.
    I recommend you read this:
    http://download-east.oracle.com/docs/cd/B31080_01/doc/owb.102/b28223/toc.htm
    Look for the following sections:
    - Using External Tables (and the "External Tables versus Flat File Operators" sub section)
    - About Flat File Modules
    - Chapter 16, Deploying Target Systems
    Regards,
    Marcos

  • How to get data from a file?

    Hello everyone, i'm new to this forum and to java too. Ok, so here is what i want to do:
    I want to get data from a file containing words and numbers and store them into variables that i will use them after to insert into a database table. For example i have a file called employees.txt in this form:
    eid ename zipcode Hire_date
    1000 "Jones" 67226 "12-DEC-95"
    In C++ i declare variables for each data and store them, for example in this case:
    ifstream in("somefile");
    string name, hdate;
    int eid, zip;
    in >> eid >> ename >> zip >> hdate;
    So i want to do the same thing in JAVA but i can't make it work. So, i would appreciate if someone could give me a simple example how to do it. Thank you.

    [http://java.sun.com/docs/books/tutorial/essential/io/index.html]

  • Cant get data from text file to print into Jtable

    Instead of doing JDBC i am using text file as database. I cant get data from text file to print into JTable when i click find button. Goal is to find a record and print that record only, but for now i am trying to print all the records. Once i get that i will change my code to search desired record and print it. when i click the find button nothing happens. Can you please take a look at my code, dbTest() method. thanks.
    void dbTest() {
    DataInputStream dis = null;
    String dbRecord = null;
    String hold;
    try {
    File f = new File("customer.txt");
    FileInputStream fis = new FileInputStream(f);
    BufferedInputStream bis = new BufferedInputStream(fis);
    dis = new DataInputStream(bis);
    Vector dataVector = new Vector();
    Vector headVector = new Vector(2);
    Vector row = new Vector();
    // read the record of the text database
    while ( (dbRecord = dis.readLine()) != null) {
    StringTokenizer st = new StringTokenizer(dbRecord, ",");
    while (st.hasMoreTokens()) {
    row.addElement(st.nextToken());
    System.out.println("Inside nested loop: " + row);
    System.out.println("inside loop: " + row);
    dataVector.addElement(row);
    System.out.println("outside loop: " + row);
    headVector.addElement("Title");
    headVector.addElement("Type");
    dataTable = new JTable(dataVector, headVector);
    dataTableScrollPane.setViewportView(dataTable);
    } catch (IOException e) {
    // catch io errors from FileInputStream or readLine()
    System.out.println("Uh oh, got an IOException error!" + e.getMessage());
    } finally {
    // if the file opened okay, make sure we close it
    if (dis != null) {
    try {
    dis.close();
    } catch (IOException ioe) {
    } // end if
    } // end finally
    } // end dbTest

    Here's a thread that loads a text file into a JTable:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=315172
    And my reply in this thread shows how you can use a text file as a simple database:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=342380

  • Use LINQ to extract the data from a file...

    Hi,
    I have created a Subprocedure CreateEventList
    which populates an EventsComboBox
    with a current day's events (if any).
    I need to store the events in a generic List communityEvents
    which is a collection of
    communityEvent
    objects. This List needs to be created and assigned to the instance variable
    communityEvents.
    This method should call helper method ExtractData
    which will use LINQ to extract the data from my file.
    The specified day is the date selected on the calendar control. This method will be called from the CreateEventList.
    This method should clear all data from List communityEvents.  
    A LINQ
    query that creates CommunityEvent
    objects should select the events scheduled for selected
    day from the file. The selected events should be added to List
    communityEvents.
    See code below.
    Thanks,
    public class CommunityEvent
    private int day;
    public int Day
    get
    return day;
    set
    day = value;
    private string time;
    public string Time
    get
    return time;
    set
    time = value;
    private decimal price;
    public decimal Price
    get
    return price;
    set
    price = value;
    private string name;
    public string Name
    get
    return name;
    set
    name = value;
    private string description;
    public string Description
    get
    return description;
    set
    description = value;
    private void eventComboBox_SelectedIndexChanged(object sender, EventArgs e)
    if (eventComboBox.SelectedIndex == 0)
    descriptionTextBox.Text = "2.30PM. Price 12.50. Take part in creating various types of Arts & Crafts at this fair.";
    if (eventComboBox.SelectedIndex == 1)
    descriptionTextBox.Text = "4.30PM. Price 00.00. Take part in cleaning the local Park.";
    if (eventComboBox.SelectedIndex == 2)
    descriptionTextBox.Text = "1.30PM. Price 10.00. Take part in selling goods.";
    if (eventComboBox.SelectedIndex == 3)
    descriptionTextBox.Text = "12.30PM. Price 10.00. Take part in a game of rounders in the local Park.";
    if (eventComboBox.SelectedIndex == 4)
    descriptionTextBox.Text = "11.30PM. Price 15.00. Take part in an Egg & Spoon Race in the local Park";
    if (eventComboBox.SelectedIndex == 5)
    descriptionTextBox.Text = "No Events today.";

    Any help here would be great.
    Look, you have to make the file a XML file type -- Somefilename.xml.
    http://www.xmlfiles.com/xml/xml_intro.asp
    You can use NotePad XML to make the XML and save the text file.
    http://support.microsoft.com/kb/296560
    Or you can just use Notepad (standard), if you know the basics of how to create XML, which is just text data that can created and saved in a text file, which, represents data.
    http://www.codeproject.com/Tips/522456/Reading-XML-using-LINQ
    You can do a (select new CommunityEvent) just like the example is doing a
    select new FileToWatch and load the XML data into the CommunityEvent properties.
    So you need to learn how to make a manual XML textfile with XML data in it, and you need to learn how to use LINQ to read the XML. Linq is not going to work against some  flat text file you created. There are plenty of examples out on Bing and Google
    on how to use Linq-2-XML.
    http://en.wikipedia.org/wiki/Language_Integrated_Query
    <copied>
    LINQ extends the language by the addition of query
    expressions, which are akin to
    SQL statements, and can be used to conveniently extract and process data from
    arrays, enumerable
    classes, XML documents,
    relational databases, and third-party data sources. Other uses, which utilize query expressions as a general framework for readably composing arbitrary computations, include the construction of event handlers<sup class="reference" id="cite_ref-reactive_2-0">[2]</sup>
    or
    monadic parsers.<sup class="reference" id="cite_ref-parscomb_3-0">[3]</sup>
    <end>
    <sup class="reference" id="cite_ref-parscomb_3-0"></sup>

  • Help Me... How to get Data from CSV File...?

    Hi Everyone..!
    This is yajiv and am working in CS3 Photoshop platform. I know about Java Script. Is it possible to get the data from CSV files. Actually our client use to send us the CSV files which contains a lot of swatch name and reference files in one particular image name.
    Actually how we work on that CSV file is, first we copy file name to search that CSV file. then get the result to paste into layer name. This process continue till the end of swatch.
    Thank in Advance
    -yajiv

    > Is it possible to get the data from CSV files.
    Have you tried searching this forum?

  • How to get data from media files such author, title and so on

    Hi you all!

    You'd have to parse the binary file header yourself. JMF doesn't have any built-in ways to extract META data from media files.
    Also, don't post your question in the title and not in the body of the message. It's annoying and stupid...

  • Sending and getting data from external file.

    I'm running it in actionscript 1  and 2 since 3 wouldn't work when getting data from external media. I'm  trying to find out how to post data to a PHP file and getting from that  file I'm trying to make the flash for something that works like a game  but differently. Since I just found out how to make the HTML stuff show  up but a lot of times, some of my text will not appear so I don't know  what's going on.
    Does anyone know how to send and get data both at the same time from a sample file?
    The sample file is example.php
    It has to sent information like ID and NAME
    and it has to get information like Description and userID

    Ned Murphy wrote:
    The tutorial I pointed you to does provide the visuals you requested, both the AS code and sample PHP code, so I can't see where your learning by visuals aspect holds up.... your approach sounds more like you want someone to hand you a tailored solution that you won't need to learn from.  Visuals require reading and doing.  If that fails to get absorbed or you couldn't understand/revise it, what could anyone else prepare for you that would work better?
    I did the tutorial and everything but every time I press the button or even load it, it keeps on saying undefined. I like the have a sample FLA file so I can figure things out. I did everything from the site but it won't work out for me.
    I did step 5 too because it was almost all that I was looking for but it won't even work. keeps on saying undefined. I would show you but webcam max won't work and I can't show you an example.
    EDIT:
    You know it's frustrating when I don't know how the heck I'm supposed to do this stuff. I read the whole dang thing and I still can't get this dang thing working.
    I did everything. EVERYTHING. I just don't get this crap.

  • Hi experts, how to use open sql to read data from one " maintenance view"?

    i want to use this part of data within report ,so how to use open sql statement to read data from one " maintenance view"?

    Hi
    You can't use OPEN SQl statements to fetch data from maintenance view
    You have to use only Database views
    see the different types of views and the difference
    The followings are different types of views:
    - Database View (SE11)
    Database views are implement an inner join, that is, only records of the primary table (selected via the join operation) for which the corresponding records of the secondary tables also exist are fetched. Inconsistencies between primary and secondary table could, therefore, lead to a reduced selection set.
    In database views, the join conditions can be formulated using equality relationships between any base fields. In the other types of view, they must be taken from existing foreign keys. That is, tables can only be collected in a maintenance or help view if they are linked to one another via foreign keys.
    - Help View ( SE54)
    Help views are used to output additional information when the online help system is called.
    When the F4 button is pressed for a screen field, a check is first made on whether a matchcode is defined for this field. If this is not the case, the help view is displayed in which the check table of the field is the primary table. Thus, for each table no more than one help view can be created, that is, a table can only be primary table in at most one help view.
    - Projection View
    Projection views are used to suppress or mask certain fields in a table (projection), thus minimizing the number of interfaces. This means that only the data that is actually required is exchanged when the database is accessed.
    A projection view can draw upon only one table. Selection conditions cannot be specified for projection views.
    - Maintenance View ( SE54 )
    Maintenance views enable a business-oriented approach to looking at data, while at the same time, making it possible to maintain the data involved. Data from several tables can be summarized in a maintenance view and maintained collectively via this view. That is, the data is entered via the view and then distributed to the underlying tables by the system.
    Please have a look at below link. It will help you.
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed06446011d189700000e8322d00/frameset.htm
    for more detailed info look on:
    http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/abap+dictionary&
    Reward points for useful Answers
    Regards
    Anji

  • Use a String to get data from a variable?

    Hi, I've got a major problem, I need to get data (int []) from a variable, using a String with the name of the variable..
    Does anyone know if this is possible?
    public class Commands {
        private static final int[] deploy_1 = {64,37,73,1};
        private static final int[] deploy_2 = {4,167,6,51};
        /** Creates a new instance of Commands */
        public Commands() {
        public int[] get(String name)
    // what code here?
    }I should be getting the data with
    int[] command = Commands.get("deploy_1");
    or something like that...
    Please help me!
    FYI, a hashtable is not a option!
    Many thanks, Vikko

    java.lang.NoSuchFieldException: deploy_1
    at java.lang.Class.getField(Class.java:1507)
    at dumb_commandstest.Commands.get(Commands.java:30)
    at dumb_commandstest.Main.getData(Main.java:36)
    at dumb_commandstest.Main.<init>(Main.java:21)
    at dumb_commandstest.Main.main(Main.java:28)
    Any ideas why I get a NoSuchFieldException?
    deploy_1 does exist.

  • Want to get data from java file

    Hi,
    I am creating a program using JBuilder. All is going fine but im having trouble reading data. Well, I want to read data from a java program which is in the same package of my program but when i wrote the command to read it i get a Exception saying:
    "java.io.FileNotFoundException: dataControl2.java (The system cannot find the file specified)"
    Below is the program i wrote to do this:
    The hole point of my program is to get temporary stored data from my conrol program that stores the data and saves it to a file. This program needs to get the user name and password and if the password is enabled or not.
    try {
    FileInputStream fi = new FileInputStream("dataControl2.java");
    ObjectInputStream oi = new ObjectInputStream(fi);
    dataControl2 dat = (dataControl2) oi.readObject();
    jTextField1.setText("" + dat.userName);
    if (dat.usePassword == 1) {
    jPasswordField1.setEditable(false);
    usePassword = 1;
    oi.close();
    } catch (Exception e) {
    jTextField1.setText("" + e.toString());
    I understand that the file cant be found, that wasnt hard to work out, but the thing is that the file does exist so i think i have wrote me program wrong.
    If you can see wat i have done wrong or wish to learn more about my query email me at:
    [email protected]
    or
    [email protected]
    Many Thanks,
    Tom

    well, i did that and this is what my program looks like now:
    try {
    File aFile = new File("dataControl2.java");
    System.out.println("absolute path : " + aFile.getAbsolutePath());
    FileInputStream fi = new FileInputStream(aFile);
    ObjectInputStream oi = new ObjectInputStream(fi);
    dataControl2 dat = (dataControl2) oi.readObject();
    jTextField1.setText("" + dat.userName);
    if (dat.usePassword == 1) {
    jPasswordField1.setEditable(false);
    usePassword = 1;
    oi.close();
    } catch (Exception e) {
    jTextField1.setText("" + e.toString());
    System.out.println("");
    System.out.println("" + e);
    Well, now i get a message saying that the file is corrupted.
    I have really screwed this up but i really need to get this fixed.
    If possible i can zip my java program and send it to you if you ask!
    tom

  • How to use Power Query to load data from a single source into multiple tables

    Hi all,
    I have a requirement to load my data into three different data models using Power Query. Is that possible?
    My source is a SharePoint survey list, with similar questions like:
    1) Course lecturer - John Doe
    1a) The course was useful (rate 1 to 5)
    1b) The lecturer displayed good knowledge of topic (rate 1 to 5)
    2) Course Lecturer - Mary Brown
    2a) The course was useful (rate 1 to 5)
    2b) The lecturer displayed good knowledge of topic (rate 1 to 5)
    I would like to split the data into separate data models (one for John Doe; another for Mary Brown), so that I can compare the different lecturers. Other than running separate surveys for each of them, I thought of using Power Query to transform the data.
    Is it possible?
    Thanks.
    Regards
    GM

    Yes, this is possible.
    Start with a single query that returns you the data for all lecturers.
    Right-click on the "all lecturers" query in the queries pane, and choose Reference, once for each lecturer. This will create a query for each lecturer.
    Open the query for each lecturer and filter the data so that only that lecturer's results are visible.
    Click "Close & Load To..." for each lecturer's query  to load the data into the data model. This will create a data model table for each lecturer.
    If your question is more about how to transform such a survey list into a table that can be easily filtered, please provide an example of how the list shows up in Power Query.
    Ehren

  • Using xml iView to get data from URL generating rss feeds

    hi,
    I have a URL
    http://xml.weather.yahoo.com/forecastrss?p=USCA1116
    from the yahoo weather site.
    It opens XML data.
    I then created an XML iView in the following way:
    In step 3 in XML source; i typed the above URL. Clicked on Next.
    In Step 4 for Selected XML translation format I chose MY_RSS_TO_XHTMLB.
    When I preview it gives the message : Error while using XML iView, please contact your system administrator.
    I have Portal SP14.
    So as mentioned before in a forum, I went to System Administration -> System Configuration -> Service Configuration -> Applications -> com.sap.portal.ivs.httpservice-> proxy
    and changed "HTTP Proxy Host" to "proxy" and "HTTP Proxy Port" to 8080.
    Then to re start I right clicked com.sap.portal.ivs.httpservice, went to Administrate and restarted the services.
    But I still get the same message
    Error while using XML iView, please contact your system administrator.
    Can you please let me know if these 2 settings are correct.
    thx.

    Hi,
    Could you please let me know if you were able to solve this issue. Inspite of all the suggested configuration we are still getting the same error, as stated by you.
    Anyone able to overcome this issue, please reply. Also let me know if we need to consider any specific versions of portal & browser, JRE etc..
    Thanks,
    KSK

  • How to get data from pdf file and send contents  of the pdf file to R/3

    Hi, experts,
    Action:
    1. Make a pdf forms (interactive form) with inputfield named “A_inputfield” in the webdynpro application and run the webdynpro application.
    2. In the IE, click the save button in the pdf interactive form and save the pdf to local disk,ex: C disk. Close the IE browser.
    3. Open the pdf interactive form from the local C disk and type "aaa" to the “A_inputfield”.
    4. I want to save the "aaa" to the R/3 system using webdynpro or using other tools . How can I do it?
    First way:
    If I use webdynpro application to save the content of the pdf, I don't find a way mapping or binding the content to a context of a view. So I don't think this way is unadvisable.
    Second way:
    Adding a button "submit" in the pdf forms when create the pdf form. Runing the webdynpro application, save the pdf to local disk,ex: C disk.  Opening the pdf interactive form from the local c disk and typing "aaa" to the “A_inputfield”, click the  "submit" button to save the content. Of course, I need to finish the code for clicking "submit" button. But I don't know how  to write these codes and where to write these codes. Do you give me some advise ?
    Best regards,
    tao

    Hi, Abhimanyu L,
    Thanks a lot for your help. Your answer can give me large developmental.:)
    I find http://help.sap.com/saphelp_erp2005/helpdata/en/67/fae9421dd80121e10000000a155106/content through searching google for CL_WD_ADOBE_SERVICES class. But I don't find any exmples for the class. Do you give me some hint for some exmples for the class?
    Best regards,
    tao
    (You can reply back to me via e-mail if you think we should discuss this internally at [email protected] or [email protected])

Maybe you are looking for

  • Replacement of a broken motherboard in an iMac is 595€ or 1.466€!!!

    Replacement of a broken motherboard in an iMac is 595€ but if I ask to return the faulty motherboard (proof of replacement, example is class, curiosity) cost suddenly rises to 1.466€. Dealer claims 595€ is the price of an "exchange" and 1.466€ is the

  • HT4906 iPhoto 09, iCloud and Photo Stream

    I have iPhoto 09, preinstalled via Snow Leopard.  I did the software update as instructed so that I could get the iCloud and Photo Stream.  However, I cannot get the check box available in iCloud to add Photo Stream.  Please help. Thank you.

  • Errors in Adaptive Web Service model

    Hi, We are trying to consume a Webservice created in XI 3 sp18 using Webdynpro adaptive webservice model in Netweaver Developer Studio SP15. The portal version is EP7 SP15 When we give a  Model name and specified the destination as EPDes while creati

  • Publication and Prompt values

    Hi, I am on customer site with BOE XI 3.1 FP 1.6. We are creating publications with a WebI source report. The WebI report has a series of prompts. Eg. posting period. The publication is pushed to 2 groups of reciepients. Each group has a different pr

  • New quicktime screen recorder and other apps

    Anyway I can use this while recording a keynote or ppt presentation. Basically, I need to be able to record pointer movements with narration while switching from slide to slide.