Help with parse... see example

Hey,
I need some help with this, i'm writing a program which reads from a database and when it does, It does some validation.
My problem is this: I need to convert it from a date to string (or string to date, it doesn't matter). I get an error saying it is an undefined data type. please see the examples of my code
So for example, cost works, when i convert to int. For parseInt illustrated here
     //Cost
     public void setCost(String sCostA) throws Exception {
          try{
               Validation.IsValid(sCostA + "","N","M","","","0","");
               iCost = Integer.parseInt(sCostA);
          }catch (Exception e){
               throw new Exception("Cost Invalid:\n"+e);
     public void setCost(int iCostA) throws Exception {
          try{
               Validation.IsValid(iCostA + "","N","M","","","0","");
               iCost = iCostA;
          }catch (Exception e){
               throw new Exception("Cost Invalid:\n"+e);
     }While if i try date, it doesn't work. Here is my code...
     //Expire_Date
     public void setExpire_Date(String sExpire_DateA) throws Exception {
          try{
               Validation.IsValid(sExpire_DateA + "","D","O","","","0","");
               dtExpire_Date = Date.parseDate(sExpire_DateA);
          }catch (Exception e){
               throw new Exception("Date_Given Invalid:\n"+e);
     public void setExpire_Date(Date dtExpire_DateA) throws Exception{
          try{
               Validation.IsDate(dtExpire_DateA + "O");
               dtExpire_Date = dtExpire_DateA;
          }catch (Exception e){
               throw new Exception ("Expire_Date is an Invalid Date:\n"+e);
     }I know there should be a way to fix this, i hope someone can help me
If there is any more info you require please let me know
Thanks in advance
Lutty182

I don't quite understand what you are doing but converting between a data and a string you might want to look at SimpleDateFormat.

Similar Messages

  • Help with parsing an UPDATE statement

    I am stuck and need help! The teacher has not gone over parsing with us
    and it is not on his scheduled topics list. But, I am a person that likes to
    scope out and learn new things. For our final project, we have to allow
    updates, delete and inserts into the 5 main tables of the Premiere Products
    database. I have done everything except for the updates. I can achieve
    the updates of the entities by pretty much hardcoding them and that is
    okay by the teacher, but I want to learn about parsing because Barbara
    from this site mentioned this to me.
    This is what I was able to write and I am getting errors:
    CREATE OR REPLACE PROCEDURE updatecust_proc (
    v_cust_num IN customera.cust_num%TYPE,
    v_attributetoupdate VARCHAR2 ,
    v_updatedvalue VARCHAR2 )
    AS
    e_invalidcustnum_error EXCEPTION;
    BEGIN
    v_isvalidcustnum := iscust(v_cust_num);
    IF (v_isvalidcustnum = FALSE) THEN
    RAISE e_invalidcustnum_error;
    END IF;
    PARSE(
    'UPDATE customer
    SET' | | v_attributetoupdate | | '=' | | v_updatedvalue | |
    'WHERE cust_num =' | | v_cust_num
    END;
    EXCEPTION
    WHEN e_invalidcustnum_error THEN
    DBMS_OUTPUT.PUT_LINE('Cannot be updated. Invalid customer number');
    END;
    Any help would be useful. I went to the Oracle help site but their examples are a little too complicated for me to understand, plus, I am not using any C code.
    Thanks in advance!
    Bob

    Now we are getting somewhere. Identifier 'PARSE' must be declared.
    I again used the 'Search' link just above the forum posts and entered 'dbms_sql.parse' and got a short list of hits (as I suggested in my previous reply).
    There is one with Barbara's name on it. It shows exactly how to do what you are trying to do. In particular note her code:
    DBMS_SQL.PARSE
    (cursor_name,
    'UPDATE client SET '
    | | v_column
    | | ' = ' | | '''' | | v_new_data | | ''''
    | | ' WHERE account_id = '
    | | v_account_id,
    DBMS_SQL.NATIVE);
    Compare her PARSE statement to yours and you will see some major differences. The PARSE procedure is defined in the DBMS_SQL package and must be reference by DBMS_SQL.PARSE as Barbara shows.
    In addition to dynamic SQL using the DBMS_SQL package Oracle 8i also supports the EXEC IMMEDIATE statement.
    All of Oracle's documentation is available online via the 'Documentation' link on the left side of the OTN home page.
    The 'Supplied PL/SQL Packages Reference' has a chapter for each package (including DBMS_SQL) and describes the procedures/functions in the package and how to use them.
    The 'Application Developers Guide - Fundamentals' has chapters on 'processing SQL statements' and 'dynamic SQL' that go into some detail on performing dynamic sql.
    Yes, Barbara's code uses a CURSOR. The DBMS_SQl package requires it and so does your code. Almost all SQL uses a CURSOR either implicitly or explicitly.
    My comments are not, and were not, directed at you personally so I hope you don't take them that way.
    Your latest reply has a lot of useful information in it.
    1. 19/1 PLS-00201: identifier 'PARSE' must be declared. This is the explicit error message we need to help someone. We don't have to guess which error they are talking about. We can look it up in the MESSAGES manual if necessary. When someone says 'I get an error', or 'I get a PARSE error' we can only guess which error they are talking about.
    In your reply you state that you looked at Barbara's code, she uses a cursor and you don't need a cursor. That is very useful information to someone trying to help you because it tells us two things: you are trying to find the answer for yourself (a lot of people just want someone to write the code for them) and it shows that you haven't made the connection between Barbara's example (which shows EXACTLY what you need to do) and your own code.
    This is a public forum and I have found it useful to keep repeating certain suggestions.
    For whatever reason many people still do not seem to realize that:
    1. ALL of Oracle's documentation is available on-line via the 'Documentation' link on the left side of the OTN main page.
    2. You can purchase (for about $50) a CD-ROM that has all of the Oracle documentation on it in both PDF and HTML format.
    3. The 'search' link just above each discussion forum allows one to search any or all forums for topics, users, etc.
    The above resources should be used by everyone.
    Good luck!
    null

  • Need help with CONTACT sync example

    I have been trying to work with the Sync example that utilizes the MEREP_CONTACT_* BAPI wrappers.  Is there anyone who has been able to get this example to work that could give more information on it?  I can create the programs, but cannot get data to it.  Which SyncType is it supposed to use?  What directory do you create the data from MEREP_SAP_EXM002_DATA_GEN1?
    Any information would be greatly appreciated.
    Thanks
    Brian Timothy
    [email protected]

    hello brian,
    i created the contactaddress test application and used these BAPIs on the backend mapped to syncBos SAP_EXM001 and SAP_EXM002. the basic requirement for this is to deploy your application together with the xml metadata.
    after your application is installed in the ME, the framework will automatically send a data download request for syncBos SAP_EXM001 and SAP_EXM002 on the next synchronization. Prior to this, the application tables in the backend like the MEREP_PERSON which is mapped to the syncbo SAP_EXM002 should be filled with data.
    use MEREP_SAP_EXM002_DATA_GEN2 and MEREP_SAP_EXM001_DATA_GEN1 to fill-up the tables with data.
    you should have at least a data viewer for the corresponding syncbo data on your application.
    hope this helps.
    regards
    jo

  • Urgent - please help with parsing HTML

    Hi,
    I'm very new to Java - i'm a biology major, actually, but taking this class for fun. Unfortunately, I'm having quite a bit of trouble with it. I've written a class that downloads a web page, converts it to a string, and then sends the string to another class, called BankRecord.
    The web page string looks something like this:
    bodylinks101>Prime Mortgage</a><br><span class=bodytext101>(909) 369-1012</span></td><td bgcolor=#e4e4e4 valign=top align=center><span class=bodytext101>4/18/2003</span><br><span class=bodytext101>10:15</td><td bgcolor=#e4e4e4 valign=top align=center><span class=bodytext101>5.875%</span>
    So, what I am trying to do is parse the HTML so that it returns, as a string, the appropriate information. For example, in the above HTML, I want "Prime Mortgage (909) 369-1012 4/18/2003" etc.
    The above is just one record, with several fields (bank name, phone number, date). The entire web page has quite a few records, for different banks, and I need to extract all of them. I think I've figured out how to find the start and end of the first record, but I don't know how to go about looking for more records. I'm guessing a loop? Also, how do I go about distinguish between the fields in each record (i.e., how to distinguish between phone number and date fields) Here is the code I have so far:
    import java.util.*;
    public class BankRecord
        //  Set up variables
        private String strContent;
        private Integer intPos;
        //  Constructor
        public BankRecord (String strVar)
             strContent = strWebPage;  // set strContent to incoming string
             intPos = 1;  // initialize intPos to 1
        public getNextRecord()
        // uses findBankStart to find next bank record; if found, return true.
        private findBankStart(intPos)
        // accept an integer indicating a place to start looking for beginning of each
        // bank record.  If there are no more records, return a -1; otherwise, return
        // starting position
             // Find beginning of record
             int intRecStart = strContent.indexOf("bodylinks101>",intRecStart);
             // Find end of record
             int intRecEnd = strContent.indexOf("bodylinks101>Apply",intRecEnd);
             // Find beginning of first field in record
             int FldStart = intRecStart + 13;
             // Find end of field in record
             int FldEnd = strContent.indexOf("<",intFldStart);
        public getField(intFldNum)
             // return the field asked for by number as a string.
    }PLEASE help as soon as possible...thank you very much.

    Thuyker,
    Here are 2 approaches:
    If you have a fixed format, parse via delimiters. For example, if each "record" is as follows:
    <span>Name</span><span>Acct No</span><span>balance</span>
    each "field" of the record is delimited by <span>...</span> tags. Thus, you could use regular old string functions such as indexOf() to read through the HTML string, and to pick apart the data you need.
    Alternatively, get a HTML parser, and let it do the work for you. A SAX-like one that I've used successfully is at http://www.quiotix.com/downloads/html-parser/
    --A                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Help with parsing a text string in address book and moving it to 'related person' field

    I am wanting to make a little applescript that will go thru my contacts and find data in the NOTES field and parse it slightly and move it to another field.  (sorry if parsing isn't the right word here)
    The data to be found is a GPS coordinate with this EXACT format:
    <Lat:12.345678><Lon:-12.345678>
    ...the only thing different from this example is the digits, and the number of digits.
    What I want to end up doing is deleting this data from the NOTES field, but leaving any other data, (this part sounds difficult to do to, to me!)
    And moving it to a related person field with the label gps, and the coordinate now reading exactly:
    12.345678,-12.345678
    (FYI, you can copy/paste a coordinate like this very fast into the maps app on iPhone and locate it instantly)
    Thanks for the help on this
    If this is too complicated I can break up the process into steps.  I know how to do some of it, but not sure about the parsing, and then delete just part of the notes field...
    Thanks!

    Hi,
    This script work here, try it :
    tell application "Address Book"
        repeat with thisContact in (get people)
            set tNote to note of thisContact
            if tNote is not missing value and "<Lat:" is in tNote and "<Lon:" is in tNote then
                set {GPS_value, newNote} to my getGPS_coordinate(tNote)
                if newNote is not "" then -- no error
                    set gpsField to (related names of thisContact whose its label = "gps")
                    if gpsField is not {} then
                        set value of (item 1 of gpsField) to GPS_value
                    else -- field "gps" is empty
                        make new related name at end of related names of thisContact with properties {label:"gps", value:GPS_value}
                    end if
                    set note of thisContact to newNote
                end if
            end if
        end repeat
        save
    end tell
    on getGPS_coordinate(this_note)
        set oldTid to text item delimiters
        set {tLat, tLon, newNote} to {"", "", ""}
        try
            set text item delimiters to "<Lat:"
            set tLat to text item 2 of this_note
            set text item delimiters to "<Lon:"
            set tLon to text item 2 of this_note
            set text item delimiters to ">"
            set {tLat, tLon} to {text item 1 of tLat, text item 1 of tLon} -- get values (lat... and long...)
            set text item delimiters to "<Lat:" & tLat & "><Lon:" & tLon & ">"
            set this_note to text items of this_note
            set text item delimiters to " "
            set newNote to this_note as string -- delete GPS coordinate in this note
        end try
        set text item delimiters to oldTid
        return {tLat & "," & tLon, newNote}
    end getGPS_coordinate

  • Help with NI-DAQ Example Code

    Hi. I've just started working with the NI ISB-6211. This is the first ACD i've ever used, so i'm farily new to this. I have quite a bit of knowledge in programming. After searching through the installation files I found some example C Code that runs in the command prompt. I've modified one quite a bit to get it to do what I want. My question is...
    Now, i'm having some issues. I'm trying to get it to print a voltage reading into the command prompt. I've hooked it all up and i've used labview to make sure everything is working as it should (Which it does!). When I compile the C program and run it, instead of returning a voltage it just aquires points, and I really have no idea what these "points" are.
    Here is the main part of the example code:
    DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
    DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0","",DAQmx_Val_Cfg_Default,1.0,10.0,DAQmx_Val_Volts,NULL));
    DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",10000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,1000));
    // DAQmx Start Code
    DAQmxErrChk (DAQmxStartTask(taskHandle));
    // DAQmx Read Code
    DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,1000,10.0,DAQmx_Val_GroupByChannel,data,1000,&read,NULL));
    printf("Acquired %d points\n",read);
    Error:
     And then it just moves down to the exit clause. Is there any documentation anywhere which tells me which DAQ command I need to use to print a continuously updating voltage read out? (Just as a decimal, like 5.21V for example).
    Thank you all
    John
    Solved!
    Go to Solution.

    John,
    The data acquired by DAQmx is written into the array called 'data'.  The number of points DAQmx wrote into this array is stored in the variable 'read' which was passed in by reference.  To print the values returned, you'd need to loop over the 'data' array, and print each value.  See this help topic for an explanation of DAQmxReadAnalogF64.
    Dan

  • Need Help with parsing text

    Hello all, I hope this is an easy question....
    I have a string similar to
    <li><span class="RandomInformation">the latest news on my site</span></li>
    I am currently geting a string where each new line is a new <li> from a pure http call. what I need to do is split this down into an array of strings (Yes this is my website, and no im not trying to rebrand other's work...:) ) delimeted on :
    - each line needs to be a separate element within a multidimensional array
    - Can't split on CrLf because further up and further down I have other entries I dont care about, so I need to use the <li></li> as indicators that they contain the information I want.
    - out of each line, I need to separate them into multiple 'columns' within the array
    - one for the contents of the span clas (in this case "RandomInformation"
    - one element for the contents of the link (in this case my url, http://www.w2gas.com, but will be sub pages later like http://www.w2gas.com/page2.html)
    - most importantly one element for the text between anchor tags (this case it is "the latest news on my site")
    I tried a Regex for stripping the HTML tags out, however all I was left with was the text between anchors. I know I could do it based on character by character looping (have done that) but its terrible slow. I know there must be a way to accomplish this, however Im just too new to figure it out. (maybe?)
    Thanks in advance
    Lee

    Would something like [this |http://htmlparser.sourceforge.net/] help?

  • Need urgent help with LayerManager (easy example)

    Im trying to get a scrolling effect by moving the view window.
    THE PROBLEM IS that if I move the view vindow the Sprite (spriteTest) is displayed at the new position AND still at the old position. I don't want it to be displayed on the old position. So if I move it a pixel every 5 ms I get a trail of the Sprite. Why does it happen??? (clueless)
    Here is the code...
    import javax.microedition.lcdui.game.GameCanvas;
    import javax.microedition.lcdui.game.LayerManager;
    import javax.microedition.lcdui.game.Sprite;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.Image;
    public class Game extends GameCanvas implements Runnable
        private Thread t; //the thread running the game
        private Midlet midlet; //the midlet
        private int DISP_WIDTH; //the width of the display
        private int DISP_HEIGHT; //the height of the display
        private int xpositionView, ypositionView; //the x and y coordinates of the view window (used for scrolling)
        private LayerManager world; //the layermanager in which all sprites are added
        private Sprite spriteTest; //a Sprite with an image looking like a goomba from super mario
        /** Creates a new instance of Game */
        public Game(Midlet midlet)
           super(true);
           this.midlet = midlet;
           xpositionView = 1;
           ypositionView = 1;
           DISP_WIDTH = getWidth();
           DISP_HEIGHT = getHeight();
           world = new LayerManager();
           world.setViewWindow(xpositionView, ypositionView, DISP_WIDTH, DISP_HEIGHT);
           try
                spriteTest = new Sprite(Image.createImage("/images/goomba.png")); //creates the sprite containing an image (no frames only 1 picture)
           catch(Exception e)
               System.out.println("Couldn't load sprite image!");
           spriteTest.setPosition(190, 30); //sets the position of the sprite
           world.append(spriteTest);      //appends the sprite to the LayerManager
        /* The game loop */
        public void run()
            Graphics g = getGraphics();
            while(true)
                move();
                render(g);
                try
                    t.sleep(5); //sleeps for 5 ms
                catch (InterruptedException ie)
        /* Moves the view window to the right*/
        private void move()
            xpositionView = xpositionView + 1; //update position 1 pixel to the right
            world.setViewWindow(xpositionView, ypositionView, DISP_WIDTH, DISP_HEIGHT); //sets the view window to the new location
        /* Render the graphics. !!!!PROBLEM!!! */
        public void render(Graphics g)
            world.paint(g, 0, 0); //paints out the LayerManager
            flushGraphics();
       /* Starts the thread */
        public void start()
            t = new Thread(this);
            t.start();
    }

    I already do sleep the Thread 5 milliseconds.
    I've uploaded pictures and other to make you understand the problem:
    http://www.freewebs.com/scrolling/picture2.jpg
    Here is the entire project (its only 122 kb small) if you can help me I would love you forever :) When you run this you will understand the problem.
    http://www.freewebs.com/scrolling/ScrollingSimple.rar
    Im desperate for help :(

  • Need help with TCP/IP example?

    Hi,
    I'm still new to labView 7.1. I'm trying to understand the TCP/IP
    On TCP/IP Server/Client example, does the server generate the data and than send that to the client? After client receives the data, it processes the data and it displays the data on the client side? If yes, than how would just display the data on client side by 1st process it on server side? Or can you do that way?
    Thanks,

    As any other "server" on the internet (web server, mail server), the server passively waits for connection requests on a certain port. The client initiates a connection to the server to get the data.
    It is up to the server program to decide what to serve, so you you can process the data any way you like before it is sent out.
    The only important issue: You must ensure that server and client agree on the type of data being exchanged, the rest is up to you.
    LabVIEW Champion . Do more with less code and in less time .

  • Need help with XML DOM example

    Im going through the DOM tutorial portion on displaying a DOM with a JTree and have a few questions
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPDOM4.html
    lets say i have the following simple XML :
    <?xml version="1.0"?>
    <circle>
      <radius>15</radius>
      <position>
        <x-coordinate>30</x-coordinate>
        <y-coordinate>50</y-coordinate>
      </position>
    </circle>why do i get a 3 text nodes in the resulting JTree, not counting the text that are children of <radius>, <x-coordinate> and <y-coordinate> elements ?

    Is this true ? How can i avoid displaying empty text nodes ?
    The empty text elements are included because by default, DocumentBuilder creates a DOM that includes all the lexical information necessary to reconstruct the original document, in it's original form. That includes comment nodes as well as text nodes. There is as yet no standard mechanism for eliminating such lexical information in the DOM so you are left with the logical structure.

  • Help with parsing logs

    Does anybody know of any tools or reference materials i can used to research how to parse log files

    http://www.google.com/search?q=java+log+analyzer

  • Drop Down menu, but with icons, see example

    I really need to do a drop down like this:
    http://www.theraider.net/,
    with the cool little icon on each line. I'm a GoLive user and
    Dreamweaver user, and I use MenuMachine on GL to do basic menus,
    but can't find any quite that intuitive for Dreamweaver. Anyway,
    can anyone more knowledgeable than me tell how the guy did that? Is
    that Javascript? A extension of some kind?

    Just to make it easier, I'm referring to the top 5 or so
    buttons, News, etc., that start with a graphic rollover, then drop
    down a text menu. I've looked at PVII stuff, but it does not appear
    to allow me to start with a graphic rollover, then drop down the
    menu. I could live for now without the icons on each line. Any
    other options?

  • Help With Servlet+JDBC Example?

    hi there
    i've made my first jsp page
    that contain two textfields name&description
    and i want that when the user presses the add button
    the information is sent to the servlet and the servlet add the information in the database
    how that can be done in the servlet?
    thank you

    You can extends the httpservlet, then implements the method of the doGet,and you can do what you want to do&#12290;
    it is easy&#65292; u had better find some book to read&#12290;

  • PLEASE help with JavaScript parsing of WSDL return

    Can someone help with parsing return WSDL data?
    My return WSDL data is a concatenated string of alias names (firstname middlename lastname generation) delininated with an "@":
    7433|ALIAS|John|W|Smith| @7432|ALIAS|Johnny| |Smith| @7430|ALIAS|JJ| |Smithers| @7431|ALIAS|JJ| |Smith| @7400|ALIAS|Jon| |Smith| @7416|ALIAS|John|Wilber|Smith|JR
    I must have these names appear on my forms in a "lastname, firstname middlename generation" format. Can anyone provide expertise in this area if I provide the table.column reference?
    alias.alternate_id = tmp[0];
    alias.type = tmp[1];
    alias.firstname = tmp[2];
    alias.middlename = tmp[3];
    alias.lastname = tmp[4];
    alias.generation = tmp[5];

    Can someone help with parsing return WSDL data?
    My return WSDL data is a concatenated string of alias names (firstname middlename lastname generation) delininated with an "@":
    7433|ALIAS|John|W|Smith| @7432|ALIAS|Johnny| |Smith| @7430|ALIAS|JJ| |Smithers| @7431|ALIAS|JJ| |Smith| @7400|ALIAS|Jon| |Smith| @7416|ALIAS|John|Wilber|Smith|JR
    I must have these names appear on my forms in a "lastname, firstname middlename generation" format. Can anyone provide expertise in this area if I provide the table.column reference?
    alias.alternate_id = tmp[0];
    alias.type = tmp[1];
    alias.firstname = tmp[2];
    alias.middlename = tmp[3];
    alias.lastname = tmp[4];
    alias.generation = tmp[5];

  • Can anyone help with associate my new iPhone with iTunes? My other old devices are there, but I see only how to delete one, not how to add one.  Thank you.

    Can anyone help with associate my new iPhone with iTunes? My other old devices are there, but I see only how to delete one, not how to add one.  Thank you.

    iTunes Match is a subscription system that allows you to upload your own music (e.g. coped from CDs) to the cloud so that it shows (in the cloud) on your devices and computers without having to sync/copy it.
    Automatic downloads allows to, for example, buy an app on your computer's iTunes and have it automatically download on your phone without having to connect and sync it or go to the Purchased tab in the App Store app on your download and download it yourself - but doing that, going to the Purchased tab and redownloading an app, should get it associated.
    But no, I'm not aware of any problems that not having it associated causes.

Maybe you are looking for

  • IBook Ethernet Network no longer working after upgrade to 10.2

    This is really strange but i was using ethernet on os 9 and the dhcp server from my speedtouch router came up and everything worked fine. But yesterday i upgraded to os x 10.2 and the ethernet connection no longer works. I have tried unplugging (this

  • Encrypt a column in a oracle table

    Hello all, is it possible to Encrypt and Decrypt a column in a Oracle table. And if possible which method can we use.. Thanks & Regards Pratik Lakhpatwala Jr Oracle DBA

  • Numbers - Strange Table/Sheet behaviour

    I have a simple document open: one worksheet with a table for bank statement analysis. I looked at the side bar and saw under the Sheet arrow that there were 2 identical tables - Table 1 and Table 2 Perhaps I had duplicated the first table as Table 2

  • New Reader DC has major problems

    I downloaded the new reader & immediately had problems opening existing PDF files. Documents Printed as PDFs to be saved to a file started automatically opening after the file saved. Finally uninstalled & reinstalled Reader 11.. But now all files  pr

  • Original Files Deleted When Added to iTunes

    If I have a folder of mp3s for a full album, when I open an mp3 in iTunes to be copied to my iTunes folder, the original mp3 file dissapears. However, when I open an mp3 that is by itself in a folder in iTunes to be copied, the original file remains