Help with this update statement..

Hi everyone,
I am trying to update a column in a table .I need to update that column
with a function that takes patient_nbr and type_x column values as a parameter.
That table has almost "300,000" records. It is taking long time to complete
almost 60 min to 90 min.
Is it usual to take that much time to update that many records?
I dont know why it is taking this much time.Please help with this update statement.
select get_partner_id(SUBSTR(patient_nbr,1,9),type_x) partner_id from test_load;
(it is just taking 20 - 30 sec)
I am sure that it is not the problem with my function.
I tried the following update and merge statements .Please correct me if i am wrong
in the syntax and give me some suggestions how can i make the update statement fast.
update test_load set partner_id = get_partner_id(SUBSTR(patient_nbr,1,9),type_x);
merge into test_load a
using (select patient_nbr,type_x from test_load) b
on (a.patient_nbr = b.patient_nbr)
when matched
then
update
set a.partner_id = get_partner_id(SUBSTR(b.patient_nbr,1,9),b.type_x);
there is a index on patient_nbr column
and the statistics are gathered on this table.

Hi Justin,
As requested here are the explain plans for my update statements.Please correct if i am doing anything wrong.
update test_load set partner_id = get_partner_id(SUBSTR(patient_nbr,1,9),type_x);
"PLAN_TABLE_OUTPUT"
"Plan hash value: 3793814442"
"| Id  | Operation          | Name             | Rows  | Bytes | Cost (%CPU)| Time     |"
"|   0 | UPDATE STATEMENT   |                  |   274K|  4552K|  1488   (1)| 00:00:18 |"
"|   1 |  UPDATE            |        TEST_LOAD |       |       |            |          |"
"|   2 |   TABLE ACCESS FULL|        TEST_LOAD |   274K|  4552K|  1488   (1)| 00:00:18 |"
merge into test_load a
using (select patient_nbr,type_x from test_load) b
on (a.patient_nbr = b.patient_nbr)
when matched
then
update
set a.partner_id = get_partner_id(SUBSTR(b.patient_nbr,1,9),b.type_x);
"PLAN_TABLE_OUTPUT"
"Plan hash value: 1188928691"
"| Id  | Operation            | Name             | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |"
"|   0 | MERGE STATEMENT      |                  |   274K|  3213K|       |  6660   (1)| 00:01:20 |"
"|   1 |  MERGE               |        TEST_LOAD |       |       |       |            |          |"
"|   2 |   VIEW               |                  |       |       |       |            |          |"
"|*  3 |    HASH JOIN         |                  |   274K|    43M|  7232K|  6660   (1)| 00:01:20 |"
"|   4 |     TABLE ACCESS FULL|        TEST_LOAD |   274K|  4017K|       |  1482   (1)| 00:00:18 |"
"|   5 |     TABLE ACCESS FULL|        TEST_LOAD |   274K|    40M|       |  1496   (2)| 00:00:18 |"
"Predicate Information (identified by operation id):"
"   3 - access("A"."patient_nbr"="patient_nbr")"Please give some suggestions..
what's the best approach for doing the updates for huge tables?
Thanks

Similar Messages

  • Immediate help required with this update statement

    update holds set area = (select newarea from stagesteps)
    where holds.stage= stagesteps.stagename and holds.step = stagesteps.STEPNAME and holds.area is not null
    When I do this, it says stagesteps.stepame is an invalid name..
    Any helps on this highly appreciated.. btw Advance thanx for your help.

    update holds h
       set area = (select ss.newarea
                     from stagesteps ss
                    where ss.stagename = h.stage
                      and ss.stepname = h.step)
    where area is not null
       and exists (select null
                     from ss.newarea
                     from stagesteps ss
                    where ss.stagename = h.stage
                      and ss.stepname = h.step);You can leave off the EXISTS clause if there will be a guaranteed matching row in stagesteps for each row in holds, or if you don't care if area is set to null if there is no match.

  • What is wrong with this update statement

    Hi all,
    I am trying to create a simple update program that allows user to enter table name, key fields and one field to update and its value.
    But report goes into dump at update statement?
    Here is the code:
    REPORT  ZTABLE_UPDATE.
    parameters: tabname(18).
    PARAMETERS: key1(15),"use at where condition
                key1val(20),
                key2(15),"use at where condition
                key2val(20),
                field2(15)."field to be updated
    PARAMETERS: yenideg1(20),
                yenideg2(20).
    CONDENSE: tabname, field2,
              yenideg1, yenideg2,
              key1val, key2val,
              key1, key2.
    data: wa like tabname.
    *update (tabname) SET field2 = yenideg1*
                     *WHERE key1 like key1val and key2 like key2val.*if sy-subrc eq 0.
      SELECT SINGLE * FROM (tabname) INTO wa
                      WHERE key1 like key1val
                        and key2 like key2val.
        WRITE / wa. "to test whether replacement is ok.
    endif.
    Thanks in advance.
    Deniz

    Hi:
    follows is ok:
    DATA: dy_table TYPE REF TO data,
          dy_line  TYPE REF TO data,
          ifc TYPE lvc_t_fcat,
          xfc TYPE lvc_s_fcat.
    DATA: it_clrs_fields LIKE TABLE OF dfies WITH HEADER LINE.
    DATA: cond(72) TYPE c,
          itab LIKE TABLE OF cond,
          itab2 LIKE TABLE OF cond.
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                 <dyn_wa>,
                 <dyn_field>,
                 <fs>.
    PARAMETERS: tabname TYPE ddobjname OBLIGATORY.
    PARAMETERS: key1(15) OBLIGATORY,"use at where condition
                key1val(20) OBLIGATORY,
                key2(15),"use at where condition
                key2val(20),
                field2(15)."field to be updated
    PARAMETERS: yenideg1(20),
                yenideg2(20).
    ***START
    CONDENSE: tabname, field2,
              yenideg1, yenideg2,
              key1val, key2val,
              key1, key2.
    CALL FUNCTION 'DDIF_FIELDINFO_GET'
      EXPORTING
        tabname              = tabname
    TABLES
       dfies_tab            = it_clrs_fields[]
      FIXED_VALUES         =
    EXCEPTIONS
       not_found            = 1
       internal_error       = 2
       OTHERS               = 3
    LOOP AT  it_clrs_fields .
      MOVE-CORRESPONDING it_clrs_fields TO xfc.
      APPEND xfc TO ifc.
      CLEAR: xfc.
    ENDLOOP.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog = ifc
      IMPORTING
        ep_table        = dy_table.
    ASSIGN dy_table->* TO <dyn_table>.
    CREATE DATA dy_line LIKE LINE OF <dyn_table>.
    ASSIGN dy_line->* TO <dyn_wa>.
    CLEAR COND.
    CONCATENATE key1 ' = ''' key1val '''' 'AND' INTO cond.
    APPEND cond TO itab.
    CLEAR COND.
    CONCATENATE key2 ' = ''' key2val '''' INTO cond.
    APPEND cond TO itab.
    SELECT  *
      INTO <dyn_wa>
      FROM (tabname)
       WHERE (itab).
    ENDSELECT.
    IF sy-subrc <> 0.
      WRITE / 'no this data in dbtab'.
      EXIT.
    ENDIF.
    CLEAR COND.
    CONCATENATE field2 ' = ''' yenideg1 '''' INTO cond.
    UPDATE (tabname) SET (cond)
                    WHERE (itab).
    IF sy-subrc EQ 0.
      SELECT SINGLE * FROM (tabname) INTO <dyn_wa>
                      WHERE (itab).
    WRITE / <dyn_wa>. "to test whether replacement is ok.
    ENDIF.
    you alse can use:
    FM: VIEW_MAINTENANCE_CALL can used to do table maintenance.
    note:
    1.to do Table Maintenance Generator.
    2.be authorized to to use tansaction sm30.
    好运,
    启明星

  • Can you please help with this select statement.

    The following code has a result, I need to modify the select somehow which only gives me the rows which are common between all PLSTS.
    Any suggestions?
    Thank you
    SELECT DISTINCT P.PLST, P.MENU, I,PNL, P.ACCESS
    FROM AUTHITEM P, I.MENUITEM
    WHERE P.MENU = I.MENU
    AND P.PNL = I.PNL
    AND P.MENU IN ('MSN, CPP')
    AND P.ACESS >= 8
    GROUP BY P.PLST, PMENU, I.PNL, P.ACCESS
    HAVING COUNT (*) >=2
    ORDER BY 2,3,4,1
    This is the result with having count > = 1, and if I add having count > =1 I get the following result
    PLST     MENU     PNL     ACCESS
    C001     MSN     LNAME     14
    C002     MSN     LNAME     14
    B008     MSN     LNAME     14
    B005     MSN     FNAME     14
    M009     MSN     LNAME     14
    C001     MSN     GNAME     14
    C002     MSN     GNAME     14
    B008     MSN     LNAME     14
    C001     MSN     FNAME     14
    C002     MSN     FNAME     14
    k008     CPP     MNAME     14
    I need this result
    PLST     MENU     PNL     ACCESS
    C001     MSN     LNAME     14
    C002     MSN     LNAME     14
    C001     MSN     GNAME     14
    C002     MSN     GNAME     14
    C001     MSN     FNAME     14
    C002     MSN     FNAME     14

    why bother with DISTINCT ?
    have a look at the results of :
    SELECT P.PLST, P.MENU, I.PNL, P.ACCESS , COUNT(*) ZCOUNT
      FROM AUTHITEM P, I.MENUITEM
    WHERE P.MENU    = I.MENU
       AND P.PNL     = I.PNL
       AND P.MENU  IN ('MSN, CPP')
       AND P.ACCESS >= 8
    GROUP BY P.PLST, P.PMENU, I.PNL, P.ACCESS
    ORDER BY 2,3,4,1
    ;and then apply HAVING COUNT(*) >= ...

  • I need help with this while() statement please!

    So I'm pretty new to Java programming and I cannot seem to understand why this is not looping if the user inputs a "n" at the end.
    Here is my code:
    * proj1nrh.java
    * Created on September 28, 2007, 2:42 PM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package proj1nrh;
    * @author Nate
    import java.util.Scanner;
    public class proj1nrh {
    /** Creates a new instance of proj1nrh */
    public proj1nrh() {
    public static void main(String[] args) {
    String areYouFinished;
    char repeat;
    Scanner keyboard = new Scanner (System.in);
    int numericResponse1,
    numericResponse2,
    numericResponse3,
    numericResponse4,
    numericResponse5,
    numericResponse6,
    numericResponse7;
    System.out.println("Survey #1");
    System.out.println("Please enther the numerical student responses (1-5) for each question:");
    System.out.println("Q1. The instructor was available for consultation.");
    numericResponse1 = keyboard.nextInt ();
    System.out.println("Q2. Student responsibilities for this course were well defined.");
    numericResponse2 = keyboard.nextInt ();
    System.out.println("Q3. Class time well spent.");
    numericResponse3 = keyboard.nextInt ();
    System.out.println("Q4. I learned a lot from the intructor in this course.");
    numericResponse4 = keyboard.nextInt ();
    System.out.println("Q5. Course material contributed to my learning.");
    numericResponse5 = keyboard.nextInt ();
    System.out.println("Q6. I was challenged in this course.");
    numericResponse6 = keyboard.nextInt ();
    System.out.println("Q7. Coming into this course, I was motivated to learn this subject.");
    numericResponse7 = keyboard.nextInt ();
    //Consume new line
    keyboard.nextLine();
    System.out.println("Are you finished (y/n)?");
    areYouFinished = keyboard.nextLine();
    repeat = areYouFinished.charAt(0);
    } while (repeat == 'n' || repeat == 'N');
    Thanks for the help!

    Ight you guys have been great help.... but I'm having another problem
    * proj1nrh.java
    * Created on September 28, 2007, 2:42 PM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package proj1nrh;
    * @author Nate
    import com.sun.xml.internal.bind.v2.schemagen.xmlschema.List;
    import java.util.Scanner;
    import java.util.ArrayList;
    public class proj1nrh {
        /** Creates a new instance of proj1nrh */
        public proj1nrh() {
        public static void main(String[] args) {
            String areYouFinished;
            char repeat;
            int n = 0;
            Scanner keyboard = new Scanner (System.in);
            int numericResponse1, sumOfResponse1,
                    numericResponse2, sumOfResponse2,
                    numericResponse3, sumOfResponse3,
                    numericResponse4, sumOfResponse4,
                    numericResponse5, sumOfResponse5,
                    numericResponse6, sumOfResponse6,
                    numericResponse7, sumOfResponse7;
            ArrayList storeValue1 = new ArrayList ();
            ArrayList storeValue2 = new ArrayList ();
            ArrayList storeValue3 = new ArrayList ();
            ArrayList storeValue4 = new ArrayList ();
            ArrayList storeValue5 = new ArrayList ();
            ArrayList storeValue6 = new ArrayList ();
            ArrayList storeValue7 = new ArrayList ();
          do {
                n = n + 1;
          System.out.println("Survey #1");
          System.out.println("Please enther the numerical student responses (1-5) for each question:");
          System.out.println("Q1. The instructor was available for consultation.");
            numericResponse1 = keyboard.nextInt ();
            storeValue1.add(numericResponse1);
            System.out.println("Q2. Student responsibilities for this course were well defined.");
            numericResponse2 = keyboard.nextInt ();
            storeValue2.add(numericResponse2);       
            System.out.println("Q3. Class time well spent.");
            numericResponse3 = keyboard.nextInt ();
            storeValue3.add(numericResponse3);
            System.out.println("Q4. I learned a lot from the intructor in this course.");
            numericResponse4 = keyboard.nextInt ();
            storeValue4.add(numericResponse4);
            System.out.println("Q5. Course material contributed to my learning.");
            numericResponse5 = keyboard.nextInt ();
            storeValue5.add(numericResponse5);
            System.out.println("Q6. I was challenged in this course.");
            numericResponse6 = keyboard.nextInt ();
            storeValue6.add(numericResponse6);
            System.out.println("Q7. Coming into this course, I was motivated to learn this subject.");
            numericResponse7 = keyboard.nextInt ();
            storeValue7.add(numericResponse7);
            //Consume new line
            keyboard.nextLine();
            System.out.println("Are you finished (y/n)?");
            areYouFinished = keyboard.nextLine();
            repeat = areYouFinished.charAt(0);
          } while (repeat == 'n' || repeat == 'N');
            int sum = 0;
    }I want to get the sum of each ArrayList 1-7 so I can divide this sum by "n" and display the average output.
    Thanks!

  • Need help with this CASE statement

    Hi everyone,
    I would like to create a CASE that references another view and uses fields in that view to create a new field in a new view.
    The fields I am working with are called LEVEL_CD and AVAILABLE_AMT.
    In this case I would like to create a field called AVAILABLE_AMT (in my new view) that inserts the AVAILABLE_AMT from the old view into the new field only if the LEVEL_CD = 1. If the LEVEL_CD is anything else but 1 I would like to insert a 0 into my new
    AVAILABLE AMOUNT field.
    This is what I have so far and it doesn't seem to work:
    CASE WHEN old_view.LEVEL_CD = 1 THEN old_view.AVAILABLE_AMT
    WHEN old_view.LEVEL_CD <> 1 THEN 0 END AS AVAILABLE_AMT
    This just gives me zeroes in every record. Can anybody spot what I am doing wrong?
    Thanks!

    SELECT <columns>,CASE WHEN old_view.LEVEL_CD
    =
    1
    THEN old_view.AVAILABLE_AMT
    ELSE 0 END AS AVAILABLE_AMTFROM old_view.PK JOIN new_view.PK WHERE....PS.PK -Primary Key
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Help with a update,select statement

    Hi all please can you help me with a update statement i am struggling with.
    I have 2 tables
    Holiday and data
    In the Holiday table i have columns for
    Machine_ID NUMBER,
    date_from DATE,
    date_to DATE,
    ID NUMBER
    Machine column represents a type of machine, the two dates represent the start and end date of a holiday and ID represents the ID of the machines that the holiday effects (as you can have many machines that are the same, so the ID unique field to seperate them.
    i.e.
    996     25-DEC-08 00:00:00     27-DEC-08 00:00:00     91     
    996     25-DEC-08 00:00:00     27-DEC-08 00:00:00     92     
    100     28-DEC-08 00:00:00     29-DEC-08 00:00:00     1
    100     28-DEC-08 00:00:00     29-DEC-08 00:00:00     2
    In the data table i have the following columns:
    DATE DATE
    Machine NUMBER
    SHIFT1S DATE
    SHIFT1F DATE
    SHIFT2S DATE
    SHIFT2F DATE
    CALS DATE
    CALF DATE
    CAP NUMBER
    CALCAP NUMBER
    total_hrs_up NUMBER
    In here i have data for every date in the calendar. The machines are cross references with the machine in holidays table.
    I run two shifts so have shift 1 start, finish. shift 2 start, finish. These are dates with times, so shift1s could be 01-01-08 09:00:00 shift1f could be 01-01-08 17:00:00.
    shift2S could be 01-01-08 21:00:00 shift2f could be 01-01-08 23:59:00.
    so that machine would be up between them hours of the day.
    Other columns include
    CALS, ,CALF = calendar start, finish, - This needs to be populated from the holiday table. currently null. So if the date is the 26 DEC and the machine is the same as what is in the holiday table then these two columns should be populated with them data
    CAP is the total number of these machines i have available.
    CALCAP is the no of machines the holiday affects -currently null
    total_hrs_up is the number of hours this machine is up and running -currently null.
    So what i need to do is populate the cals, calf calcap, total_hrs_up columns.
    total_hrs_up is the important one, this needs to work out based on the two shift patterns the number of hours that the machine is available and then take off the holiday hours to give a final value.
    so current data example in data is
    date machine shifts shiftf shift2s shift2f cals, calf, cap, calcap, total_hrs
    16-JUL-08     100 09:00:00     17:00:00     12:00:00     00:00:00               '','','',1     ,''     
    16-JUL-08     105 09:00:00     17:00:00     12:00:00     00:00:00               '','','',1     ,''
    16-JUL-08     107 09:00:00     17:00:00     12:00:00     00:00:00               '','','',1     ,''
    id like to see based on the holiday table if there is a holiday then this data is updated as such and a total_hrs machine is available populated on that date.
    Any help is very much appreciated!
    Thanks

    Hi,
    The following query does what you requested.
    It makes the following assumptions:
    (a) in data, shift1start <= shift1finish
    (b) in holiday, hol_start <= hol_finish
    (b) in data, the combination (machine, shift1start) is unique
    (c) in holiday, hol_start <= hol_finish
    (d) in holiday, rows for the same machine and id never have overlapping dates (including times). For example:
    INSERT INTO holiday (machine, id, date_from, date_to)
    VALUES (200, 1, '26-DEC-08 07:00:00', '26-DEC-08 09:59:59');
    INSERT INTO holiday (machine, id, date_from, date_to)
    VALUES (200, 1, '26-DEC-08 09:00:00', '26-DEC-08 09:59:59');will cause a probem. Multiple rows for the same machine and day are okay, however, if the times do not overlap, like the following:
    INSERT INTO holiday (machine, id, date_from, date_to)
    VALUES (200, 1, '26-DEC-08 07:00:00', '26-DEC-08 08:59:59');
    INSERT INTO holiday (machine, id, date_from, date_to)
    VALUES (200, 1, '26-DEC-08 09:00:00', '26-DEC-08 09:59:59');Here's the UPDATE statement:
    UPDATE     data     m
    SET     (     hol_start
         ,     hol_finish
         ,     no_of_available_minutes
         ) =
    (     SELECT     MIN (date_from)
         ,     MAX (date_to)
         ,     (     MAX (shift1finish - shift1start)     -- Total from data
              -     ( NVL     ( SUM     ( LEAST (date_to, shift1finish)
                             - GREATEST (date_from, shift1start)
                        , 0
                        )                    -- Total from holiday
                   / MAX (total_no_of_machines)          -- Average
              ) * 24 * 60                         -- Convert days to minutes
         FROM          data     d
         LEFT OUTER JOIN     holiday     h     ON     h.machine     = d.machine
                             AND NOT     (     date_from     > shift1finish
                                  OR      date_to          < shift1start
         WHERE          d.machine     = m.machine
         AND          d.shift1start     = m.shift1start
    );The subquery has to use its own copy of data (that is, in needs d, not m), since the subquery has to return a non-NULL number of minutes when no rows in h match m.

  • My iPod touch was stolen and recovered.  I can use my Apple id for this site but the theif changed the Apple id needed to update apps etc and I do not know how to delete his acct. Any help with this will be greatly

    My iPod touch was stolen and recovered.  I can use my Apple id for this site but the theif changed the Apple id needed to update apps etc and I do not know how to delete his acct. Any help with this will be greatly appreciate

    If the thief enabled activation lock on the device, then there is nothing that can be done.  Only the password for the Apple ID that it is locked with can disable activation lock.

  • Since updating to FF 8 I can no longer use Multirow book marks, can anyone help with this issue?

    Since updating to FF 8 I can no longer use Multi-row book marks, can anyone help with this issue? the one I used is here http://multirowbookmarkstoolbar.com/

    Try the support site:
    *http://multirowbookmarkstoolbar.com/forum
    *Multirow Bookmarks Toolbar Plus: https://addons.mozilla.org/firefox/addon/multirow-bookmarks-toolbarplus/

  • I cannot download updates to Photoshop Elements 9.  I get an error message that my serial number is not recognized or eligible.  Can you help with this?

    I cannot download updates to Photoshop Elements 9.  I get an error message that my serial number is not recognized or eligible.  Can you help with this?

    Hi,
    Which operating system are you running on?
    What updates are you trying to download?
    The last update was 9.0.3 - check by loading the editor and going to Help -> About Photoshop Elements
    The last supported Camera raw is ACR 6.5 - check by loading the editor and going to Help -> About Plug-ins -> Camera Raw
    Do you have a reason to update?
    Brian

  • Please help! I am trying to change my Apple Id that used to be my mother to Mine- Every time i have it changed and i go and try and do an update it continues to ask for her old password. I really need help with this!

    Please help! I am trying to change my Apple Id that used to be my mother to Mine- Every time i have it changed and i go and try and do an update it continues to ask for her old password. I really need help with this!

    Phil0124 wrote:
    Apps downloaded with an Apple ID are forever tied to that Apple ID and will always require it to update.
    The only way around this is to delete the apps that require the other Apple ID and download them again with yours.
    Or simply log out of iTunes & App stores then log in with updated AppleID.

  • I recently updated my computer to 10.6 and now I can't get my printer MX340 (canon ) to work. I have installed the new drivers both from Canon's website and from an earlier post directly from apples website. I would surely appreciate some help with this.

    I recently updated my computer to 10.6 and now I can't get my printer MX340 (canon ) to work. I have installed the new drivers both from Canon's website and from an earlier post directly from apples website. I would surely appreciate some help with this.

    Try what Terence Devlin posted in this topic:
    Terence Devlin
    Apr 14, 2015 11:21 AM
    Re: Is Iphoto gone ? i want it back!
    in response to Johannes666
    Recommended
    Go to the App Store and check out the Purchases List. If iPhoto is there then it will be v9.6.1
    If it is there, then drag your existing iPhoto app (not the library, just the app) to the trash
    Install the App from the App Store.
    Sometimes iPhoto is not visible on the Purchases List. it may be hidden. See this article for details on how to unhide it.
    http://support.apple.com/kb/HT4928
    One question often asked: Will I lose my Photos if I reinstall?
    iPhoto the application and the iPhoto Library are two different parts of the iPhoto programme. So, reinstalling the app should not affect the Library. BUT you should always have a back up before doing this kind of work. Always.

  • I need help with this code error "unreachable statement"

    the error_
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errors
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    public class Tools//tool class
    private int numberOfToolItems;
    private ToolItems[] toolArray = new ToolItems[10];
    public Tools()//array of tool
    numberOfToolItems = 0;
    for(int i = 0; i < toolArray.length; i++)//for loop to create the array tools
    toolArray[i] = new ToolItems();
    }//end for loop
    }//end of array of tools
    public int search(int id)//search mehtod
    int index = 0;
    while (index < numberOfToolItems)//while and if loop search
    if(toolArray[index].getID() == id)
    return index;
    else
    index ++;
    }//en while and if loop
    return -1;
    }//end search method
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0;
    int index;
    index = search(id); <-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    }//end delete method
    public void display()//display method
    for(int i = 0; i < numberOfToolItems; i++)
    //toolArray.display(g,y,x);
    }//end display method
    public String getRecord(int i)//get record method
    // return toolArray[i].getName()+ "ID: "+toolArray[i].getID()
    }//end getrecod
    }//end class
    Edited by: ladsoftware on Oct 9, 2009 6:08 AM
    Edited by: ladsoftware on Oct 9, 2009 6:09 AM
    Edited by: ladsoftware on Oct 9, 2009 6:10 AM
    Edited by: ladsoftware on Oct 9, 2009 6:11 AM

    ladsoftware wrote:
    Subject: Re: I need help with this code error "unreachable statement"
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errorsThe compiler is telling you exactly what the problems are:
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0; // <<== HERE you return, so everyting in the if block after this is unreachable
    int index;
    index = search(id);  //< -----------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    // <<== HERE where is the return statement?
    }//end delete method
    public String getRecord(int i)//get record method
    // return toolArray.getName()+ "ID: "+toolArray[i].getID() <<== HERE you commented out the return statement
    }//end getrecod
    }//end class

  • HT2492 When I try to update Adobe Flash Player I'm prompted to quit Safari and Dashboard Client. I quit Safari but I don' know how to quit Dashboard Client. Can anyone help with this challenge?

    When I try to update Adobe Flash Player I'm prompted to quit Safari and Dashboard Client. I quit Safari but I don' know how to quit Dashboard Client. Can anyone help with this challenge?

    Carolyn,
    Thank you. It worked
    Angus.

  • HT201210 How can i stop loosing all my videos, music, pics etc after an IOS update? PLEASE can somebody help me as i've lost everthing the last time i proceeded with this update so this time my mam thought she was doing the right thing by updating my phon

    How can i stop loosing all my videos, music, pics etc after an IOS update? PLEASE can somebody help me as i've lost everthing the last time i proceeded with this update so this time my mam thought she was doing the right thing by updating my phone!! :C

    everything should be on your computer.
    If you do as you should and make sure that everything is on your computer, then you should lose nothing.

Maybe you are looking for

  • Which is better as UI technology among Flex and Oracle ADF for oracle SOA suit

    We have one application which is using oracle's Service oriented Architecture (SoA) suite. Currently, there is a debate on the technology for UI in the new architecture that will be rich, easy to maintain, scalable and integrates well with SOA suite.

  • Burning a playable DVD.  No technical jargon please!

    I have asked a simliar question before and it is probably quite elementary but I am not familiar with how to do this. I want to take a "movie" from FCP and burn it to a DVD (that will play in a player) using DVD studio pro or whatever works. What is

  • Populate Field from Concatenated Values Issues

    I am trying to set a value on a read only/calculated text field based on the exit event of another field, below is what I'm using, but nothing happens when I enter data and exit the field. Year0 is a hidden calculated field set to current year in a 4

  • Waiting page + redirection

    Hi everyone! My problem is that i have a specific service that takes some time to be executed. So a user enters in a form some data and then i send him to waiting page. After the execution of the service i want him to redirect him to the page where h

  • Executemenucommand for Document Color Mode

    How to executemenucommand for Document Color Mode in illustrator using Javscript