Help with these java statements

Can someone help me understand the following :
"There are no errors but the loop terminates prematurely due to condition using the incorrect relational operator. The values of TotalVAT and TotalCosts will be 0.0."
double[] Costs = {10.00, 20.00, 30.00, 15.00};double TotalCost = 0.0;double TotalVAT = 0.0;for (int Count = 0; Count > Costs.length; Count++) { double VAT = Costs[ Count ] * 0.175; TotalVAT = TotalVAT + VAT; TotalCost = TotalCost + Costs[ Count ] + VAT;}
[\code]
Thank you,

  double[] Costs = {10.00, 20.00, 30.00, 15.00};
  double TotalCost = 0.0;
  double TotalVAT = 0.0;
  for (int Count = 0; Count > Costs.length; Count++)
    double VAT = Costs[ Count ] * 0.175;
    TotalVAT = TotalVAT + VAT;
    TotalCost = TotalCost + Costs[ Count ] + VAT;
  }"the loop terminates prematurely" = the loop ends too early,
it's not run as often as you think it would be. With loops that is
often either once too few or not at all, in this case the latter.
"due to condition using the incorrect relational operator" ->
relational operators are operators that compare numbers (or other
data), e.g. ==, !=, <, and >. There is only one relational operator
here, it's >.
For-loops work like this:
for (init; cond; inc)
init is the initialization, that's fine here: int Count = 0
cond is a condition that has to be met everytime the loop starts from
the beginning (not like in some other languages, where the condition is
the one that will lead to the end of the loop). So here it checks
whether Count > Costs.length is true and only then it will be executed.
That's of course nonsense - you want to repeat that loop while Count is
still less than Costs.length and you want to stop when it reaches
Costs.length or goes above it, not the other way around. You loop will
never execute at all! So simply replace the > with a <.
(inc is the incrementation, that's fine here, too.)
Say, who wrote that comment "There are no errors but the loop
terminates prematurely due to condition using the incorrect relational
operator. The values of TotalVAT and TotalCosts will be 0.0."? Was that
a contest about being as verbose and ununderstandable as possible?
A note: Only classes (and interfaces) start with capital letters. Use
lower case letters for variables (and methods and packages): costs,
totalCost, totalVAT, count, vat. (ALL CAPS are used for constants.)
Hope this helps,
Monika.

Similar Messages

  • Please help me with these java puzzle ?

    Dear all,
    My friend send me typical java puzzle about java.util.ArrayList
    which is getting messy. Please help me out. It's not a homework.
    Please help me with these java puzzle ?
    Dear all,
    My friend send me typical java puzzle about java.util.ArrayList
    which is getting messy. Please help me out. It's not a homework.
    import java.util.*;
    public class MyInt ______ ________ {
    public static void main(String[] args) {
    ArrayList<MyInt> list = new ArrayList<MyInt>();
    list.add(new MyInt(2));
    list.add(new MyInt(1));
    Collections.sort(list);
    System.out.println(list);
    private int i;
    public MyInt(int i) { this.i = i; }
    public String toString() { return Integer.toString(i); }
    ________ int ___________ {
    MyInt i2 = (MyInt)o;
    return ________;
    }Hints , fill the underlines with below :
    implements
    extends
    Sortable
    Object
    Comparable
    protected
    public
    i = i2.i
    i
    i2.i=i
    compare(MyInt o, MyInt i2)
    compare(Object o, Object i2)
    sort(Object o) sort(MyInt o)
    compareTo(MyInt o)
    compareTo(Object o)

    Dear all,
    My friend send me typical java puzzle aboutNotwithstanding your pathetic protestations typicial
    of all your posts this is NOT a typical java "puzzle"
    but is indeed a typical homework puzzle.
    And it's damn easy if you spent 30 minutes with a
    tutorial.
    DO YOUR OWN HOMEWORK!
    Hey i did it.
    import java.util.*;
    public class MyInt implements Comparable {
    public static void main(String[] args) {
    ArrayList<MyInt> list = new ArrayList<MyInt>();
    list.add(new MyInt(2));
    list.add(new MyInt(1));
    Collections.sort(list);
    System.out.println(list);
    private int i;
    public MyInt(int i) { this.i = i; }
    public String toString() { return Integer.toString(i); }
    public int compareTo(Object o){
    MyInt i2 = (MyInt)o;
    return i;
    }E:\>javac MyInt.java
    Note: MyInt.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    E:\>java MyInt
    [1, 2]

  • Need help with the session state value items.

    I need help with the session state value items.
    Trigger is created (on After delete, insert action) on table A.
    When insert in table B at least one row, then trigger update value to 'Y'
    in table A.
    When delete all rows from a table B,, then trigger update value to 'N'
    in table A.
    In detail report changes are visible, but the trigger replacement value is not set in session value.
    How can I implement this?

    You'll have to create a process which runs after your database update process that does a query and loads the result into your page item.
    For example
    SELECT YN_COLUMN
    FROM My_TABLE
    INTO My_Page_Item
    WHERE Key_value = My_Page_Item_Holding_Key_ValueThe DML process will only return key values after updating, such as an ID primary key updated by a sequence in a trigger.
    If the value is showing in a report, make sure the report refreshes on reload of the page.
    Edited by: Bob37 on Dec 6, 2011 10:36 AM

  • Sign on problems within Elements 10; plus cannot backup writing files error with file catalog.pse10db.  No indication what the problem is.  How do I get adobe help with these problems?

    Sign on problems within Elements 10; plus cannot backup, writing files error with file catalog.pse10db.  No indication what the problem is.  How do I get adobe help with these problems?

    Sign on problems within Elements 10; plus cannot backup, writing files error with file catalog.pse10db.  No indication what the problem is.  How do I get adobe help with these problems?

  • I need help with these two crash IDs nsStyleContext::FindChildWithRules(nsIAtom const*, nsRuleNode*) and DFusionWebPlugin@0x86b5

    I need help with these two crashes...
    PL_DHashTableOperate | GCGraphBuilder::NoteRoot(unsigned int, void*, nsCycleCollectionParticipant*)
    DFusionWebPlugin@0x86b5
    The first one happened a couple of days ago, a few times and not on any specific website.
    The second one only happens on the site below.

    The second one indicates a problem with the DFusionWebPlugin that shows in your More system details list.
    # D'Fusion Web Plug-In for Safari 64 bits (3.00.13774.0)
    # D'Fusion Web Plug-In (3.00.13774.0)
    What you posted are crash signatures.<br />
    It might help if you post the actual crash IDs (bp-xxxxxxxx-xxxxxxxxx-xxxx-xxxxxxxxxxxx).<br />
    You can find the IDs of the submitted crash reports on the <i>about:crashes</i> page.
    See http://kb.mozillazine.org/Breakpad (Mozilla Crash Reporter)

  • Help with these queries

    Hi all,
    I need a help with these queries, because is happening a strange problem when I try to execute it.
    This first query is executed faster than the other one, around 30 minutes faster.
    The queries are the same, but there is a single difference, I switch the hard code value '5.93218%' in a like condition by a variable P_COD_RAIZ || '%', because it can't be hard code.
    SELECT max(oh.ohipp) as mesano_ultfatura
    INTO V_MESANO_FATURA
    FROM sysadm.orderhdr_all@dl_bsc oh,
    customer_all@dl_bsc ca
    WHERE ca.custcode like '5.93218%'
    and ca.customer_id = oh.customer_id
    and oh.ohipp = (select max(yy.ohipp)
    from orderhdr_all@dl_bsc yy
    where yy.customer_id = oh.customer_id
    and oh.ohinvtype = 5);
    SELECT max(oh.ohipp) as mesano_ultfatura
    FROM sysadm.orderhdr_all@dl_bsc oh,
    customer_all@dl_bsc ca
    WHERE ca.custcode like P_COD_RAIZ || '%'
    and ca.customer_id = oh.customer_id
    and oh.ohipp = (select max(yy.ohipp)
    from orderhdr_all@dl_bsc yy
    where yy.customer_id = oh.customer_id
    and oh.ohinvtype = 5);
    What I want to know is, why the execution time of the second query is greater than the first, if the only difference between it is a variable instead of hard code?
    Thanks,
    Murilo.

    I assume column custcode is also varchar2. Then it looks like a problem with bind values and not evenly distributed data.
    When you first run the query with the parameter = '5%' you may get many values and another execution plan as with '5.93218%' on a second run. However the execution plan is saved between the first and second run and not adopted to the new values.
    There are ways out of this "bind" problem. But all have to do with providing us a good execution plan first.
    However you can start by yourself with forcing the use of the index on the column custcode.

  • 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

  • Need help with **** Invalid Cursor State ****

    Hi,
    can someone tell me why am i getting this error....
    //******java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
    Any help is greatly appreciated.....
    Thanks in advance.
    //***********this is the output on servlet side**************//
    Starting service Tomcat-Standalone
    Apache Tomcat/4.0.3
    Starting service Tomcat-Apache
    Apache Tomcat/4.0.3
    init
    DBServlet init: Start
    DataAccessor init: Start
    Accessor init: Loading Database Driver: sun.jdbc.odbc.JdbcOdbcDriver
    DataAccessor init: Getting a connection to - jdbc:odbc:SCANODBC
    username SYSDBA
    password masterkey
    DataAccessor init: Preparing searchPolicy
    DataAccessor init: Prepared policySearch
    DataAccessor init: Prepared ssnSearch
    DataAccessor init: End
    After the myDataAccessor
    Database Connection...
    in doGet(...)
    SSSSSSSGetpolicynumber
    In GetPolicyInformation
    b05015195
    Getting Policy Informaton for = b05015195
    okay, building vector for policy
    in GetPolicyInformation for = b05015195
    starting query... policy Information
    finishing query... Policy Information
    Inside the while(next) loop
    sun.jdbc.odbc.JdbcOdbcResultSet@4db06e
    sun.jdbc.odbc.JdbcOdbcResultSet@4db06e
    b05015195
    policy information constructor with resultset
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
    at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3266)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:
    5398)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:326)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:383)
    at viewscreenappletservlet.policyinformation.<init>(policyinformation.ja
    va:56)
    at viewscreenappletservlet.DatabaseAccessor.getPolicyInformation(Databas
    eAccessor.java:145)
    at viewscreenappletservlet.Servlet.policyDisplay(Servlet.java:108)
    at viewscreenappletservlet.Servlet.doGet(Servlet.java:91)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServl
    et.java:446)
    at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java
    :180)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:243)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
    torBase.java:475)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
    2343)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:180)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
    rValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
    468)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:174)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
    r.java:1012)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
    va:1107)
    at java.lang.Thread.run(Thread.java:484)
    result set closed
    1
    sending response
    Sending policy vector to applet...
    Data transmission complete.

    1) JDBC-ODBC driver is buggy
    2) Some drivers (truly speaking most of them) doesn't
    support cursors or supports them in a wrong way
    Paul

  • Simple help with a delete statement

    hello guys
    i have a table like such
    CREATE TABLE FWENCUM
        "FWENCUM_FUND"            VARCHAR2(6 BYTE),
        "FWENCUM_GRNT"            VARCHAR2(9 BYTE),
        "FWENCUM_ORG"             VARCHAR2(6 BYTE),
        "FWENCUM_PROG"            VARCHAR2(6 BYTE),
        "FWENCUM_ACCT"            VARCHAR2(6 BYTE),
        "FWENCUM_ACTV"            VARCHAR2(6 BYTE),
        "FWENCUM_LOCN"            VARCHAR2(6 BYTE),
        "FWENCUM_INDCOST_BUDGET"  NUMBER(17,2),
        "FWENCUM_GRANT_TOTAL"     NUMBER(17,2),
        "FWENCUM_FUND_TOTAL"      NUMBER(17,2),
        "FWENCUM_BUDGET_FUND"     NUMBER(17,2),
        "FWENCUM_YTD_FUND"        NUMBER(17,2),
        "FWENCUM_INDCOST_YTD"     NUMBER(17,2),
        "FWENCUM_INDCOST_COMM"    NUMBER(17,2),
        "FWENCUM_ERROR"           VARCHAR2(2 BYTE),
        "FWENCUM_AMOUNT_ENCUMBER" NUMBER(17,2)
      )with these values
    REM INSERTING into FWENCUM
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('240051','240051','07171','01','7623',' ',' ',131635,34865.08,96873.92,-104,null,null,null,null,-104);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420461','420420','04720','02','7623',' ',' ',15600,12287.6,0,124783.52,null,null,null,null,3312.4);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420462','420420','04330','02','7623',' ',' ',15600,7372.56,0,124783.52,null,null,null,null,8227.44);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420456','420420','23040','02','7623',' ',' ',26000,5810.01,0,124783.52,null,null,null,null,20189.99);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420421','420420','04100','02','7623',' ',' ',15600,12287.6,0,124783.52,null,null,null,null,3312.4);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420422','420420','06370','02','7623',' ',' ',31200,27066.52,0,124783.52,null,null,null,null,4133.48);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420423','420420','23050','02','7623',' ',' ',15600,10171.91,0,124783.52,null,null,null,null,5428.09);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420424','420420','04340','02','7623',' ',' ',15600,0,0,124783.52,null,null,null,null,15600);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420451','420420','23050','02','7623',' ',' ',26000,24078.7,0,124783.52,null,null,null,null,1921.3);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420452','420420','22070','02','7623',' ',' ',26000,4050.97,0,124783.52,null,null,null,null,21949.03);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420453','420420','18350','02','7623',' ',' ',26000,9502.1,0,124783.52,null,null,null,null,16497.9);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420454','420420','04340','02','7623',' ',' ',26000,426.38,0,124783.52,null,null,null,null,25573.62);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420455','420420','09060','02','7623',' ',' ',26000,1561.25,0,124783.52,null,null,null,null,24438.75);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420460','420420','04310','02','7623',' ',' ',15600,12287.6,0,124783.52,null,null,null,null,3312.4);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420458','420420','05690','02','7623',' ',' ',26000,0,0,124783.52,null,null,null,null,26000);
    Insert into FWENCUM (FWENCUM_FUND,FWENCUM_GRNT,FWENCUM_ORG,FWENCUM_PROG,FWENCUM_ACCT,FWENCUM_ACTV,FWENCUM_LOCN,FWENCUM_INDCOST_BUDGET,FWENCUM_INDCOST_YTD,FWENCUM_INDCOST_COMM,FWENCUM_GRANT_TOTAL,FWENCUM_FUND_TOTAL,FWENCUM_BUDGET_FUND,FWENCUM_YTD_FUND,FWENCUM_ERROR,FWENCUM_AMOUNT_ENCUMBER) values ('420457','420420','18110','02','7623',' ',' ',26000,3543.58,0,124783.52,null,null,null,null,22456.42);i basically want to delete all the rows where the sum of fwencum_amount_ecumber greater then the single value under fwencum_grant_total for that grant by grant code in other words the expected output should be to delete 15 rows.
    because the sum of fwencum_Amount_encumber for grant 420420 would be greater then the 124,783.52 under the fwencum_grant_Total
    i have tried doing this but i keep getting errors can i get a little advise.
    here is my poor attempt
    DELETE  fwencum
      WHERE  (select sum(f.fwencum_amount_encumber) from fwencum f) > (SELECT DISTINCT
                                                                        FWENCUM_GRANT_TOTAL
                                                                        FROM fwencum F, FWENCUM F2
                                                                        WHERE F.fwencum_grnt=F2.FWENCUM_GRNT);Edited by: mlov83 on Sep 22, 2011 7:24 PM

    Hi,
    Thanks for posting the CREATE TABLE and INSERT statemnts; that's very helpful.
    It looks like only 3 columns play any role in this problem. If so, why are you posting 16 colummns?
    One way to do what you want (as I understand the problem) is to do a Correlated Sub-Query , where the sub-query references something in the main statement, and therefore (potentially) does something different for each row in the main statement, like this:
    DELETE     fwencum       m     -- m is for main
    WHERE     fwencum_grant_total < (
                        SELECT  SUM (fwencum_amount_encumber)
                        FROM     fwencum
                        WHERE     fwencum_grnt     = m.fwencum_grnt
    ;

  • Hello, im new to mac and I need some help with a java problem.

    Hello, im new to mac. I just need someone who can help with a problem ive come across when playing online games that run java. The game is arcanists. its on the funorb website. really fun game and i love it, but i cant play it without my screen keep scrolling or my character not responding at all. please get back at me ASAP. thx apple friends!

    FF has an extention that can be used to increase the conection speed. Its called Tweak Network 1.1 I see a difference on my iMac G5. Its not huge but it may be a big difference on yours.
    http://www.bitstorm.org/extensions/tweak/

  • Help with some java login code

    hey,
    I am a new member but used to visit the site regularly. I am undergoing a java project and I cannot seem to get my head around how to code when users log in, there name must appear at the top of each page they visit.
    User enters name into a text box. Do I use getter and setter methods? any bit of help would be of some advantage to me.
    Thanks for your time and I'll help with anyone else who is stuck.

    if JSP or servlet use Session...
    if you are using frame you have to consider... which frame is a top parent. that top frame will have the set and get method.. for you to set and retrieve the user name.. bear in mind that different object will have different user...
    so you have to play fair game ...hehehehe :-)

  • Help with some Java Programs

    Hi all ..
    i am a new in Java and i need some help with my School Project ,,,
    Will you help me ??
    regards,
    Toota

    People here will answer questions and comment on your code, but don't ecpect them to debug your source nor do your homework for you.

  • Help with a CASE statement

    Please help me with a CASE Statement:
    - When ID = 15, 16, 17, 18 then "Bad"
    - when ID = 19, then "Average"
    - when ID = 21, then "Good"
    - else "Null"
    Thank you!!

    Well the 1st thing to do would be to correct my poor spelling... change    Delault : to Default :
    Don't know why you would get an error stating "The result of selection formula must be a boolean". It's working fine on my machine.
    If your ID field is numbers stored text you have a couple different options...
    1) Convert the ID to a number...
    Select  ToNumber({home.noone_ID})
    2) Wrap the ID values in double quotes...
       Case "15", "16", "17", "18" :
          "BAD"
    Even if this were your problem... the error should be something other than the boolean thing...
    Jason

  • Help with a return statement please!

    hey, just hoping somone can help me with this return statement
    i have to add a method called "specialReport" this method takes a year as it's parameter. if the parameter is not a year between 1930 and 1969 inclusive it displays an error message, "not a valid year"
    if the parameter is a valid year, then it compares the parameter with the year field. if they are the same, and is the movie has been rented at least five times, the method will display the message "a good year for movies" if the years are different or the movie has NOT been rented at least five times, the method displays the message "try a different year"
    btw, the Year field is : yearReleased
    all help is very much appreciated!

    public void specialReport(int year){
       //add functionality to process here
       return;
    }

  • Can anyone help with the java applet issue

    Hello everyone,
    This is my first thread in this forum,
    I need a little help with the form developer...
    I have oracle 9i db , 9i form developer
    I don't want to run the form i created as a java applet
    HOW IS THAT DONE i.e NOT IN THE INTERNET EXPLORER?????????
    ***IF ITS POSSIBLE

    Hello,
    I don't want to run the form i created as a java applet
    No chance, because the Web Forms client is an applet and cannot be anything else.
    Francois

Maybe you are looking for

  • Client Copy from BWP to BWT

    I had a problem with my List Cube Transaction and for that reason, I had a look at the Infoprovider and also the Data Sources. When tried to execute the infoproviders in LISTCUBE, the following messages are being displayed in BWT system: 1. Error rea

  • Can't launch safari on new hdd

    Hdd was replaced at Apple store. Now the whole computer is super slow and won't even launch safari. Also been trying to restore lost files from Carbonite which is also been painfully slow

  • Can't install lightroom 4,

    Can't install lightroom 4, keep getting The operation couldn't be completed(com.apple.installer..pagecontroller error-1.)

  • Reading RAW files from Nikon D600 in CS5.

    I have installed the latest plug in updates for camera raw into cs5 but still cannot read raw files. Any advice? Many thanks in advance.

  • BRBackup Finished with errors

    Hi, I have scheduled an offline backup on my QA database. BRBackup finished the comression of all the datafiles and while starting the database it has returned errors. Error log is BR0280I BRBACKUP time stamp: 2009-06-12 20.39.40 BR0063I 51 of 51 fil