Need help on how to code this SQL statement! (one key has leading zeros)

Good day, everyone!
First of all, I apologize if this isn't the best forum.  I thought of putting it in the SAP Oracle database forum, but the messages there seemed to be geared outside of ABAP SELECTs and programming.  Here's my question:
I would like to join the tables FMIFIIT and AUFK.  The INNER JOIN will be done between FMIFIIT's MEASURE (Funded Program) field, which is char(24), and AUFK's AUFNR (Order Number) field, which is char(12).
The problem I'm having is this:  All of the values in AUFNR are preceeded by two zeros.  For example, if I have a MEASURE value of '5200000017', the corresponding value in AUFNR is '005200000017'.  Because I have my SQL statement coded to just match the two fields, I obviously get no records returned because, I assume, of those leading zeros.
Unfortunately, I don't have a lot of experience coding SQL, so I'm not sure how to resolve this.
Please help!  As always, I will award points to ALL helpful responses!
Thanks!!
Dave

>
Dave Packard wrote:
> Good day, everyone!
> I would like to join the tables FMIFIIT and AUFK.  The INNER JOIN will be done between FMIFIIT's MEASURE (Funded Program) field, which is char(24), and AUFK's AUFNR (Order Number) field, which is char(12).
>
> The problem I'm having is this:  All of the values in AUFNR are preceeded by two zeros.  For example, if I have a MEASURE value of '5200000017', the corresponding value in AUFNR is '005200000017'.  Because I have my SQL statement coded to just match the two fields, I obviously get no records returned because, I assume, of those leading zeros.
> Dave
You can't do a join like this in SAP's open SQL.  You could do it in real SQL ie EXEC.... ENDEXEC by using SUSBTR to strip off the leading zeros from AUFNR but this would not be a good idea because a)  modifying a column in the WHERE clause will stop any index on that column being used and b) using real SQL rather than open SQL is really not something that should be encouraged for database portability reasons etc. 
Forget about a database join and do it in two stages; get your AUFK data into an itab, strip off the leading zeros, and then use FAE to get the FMIFIIT data (or do it the other way round). 
I do hope you've got an index on your FMIFIIT MEASURE field (we don't have one here); otherwise your SELECT could be slow if the table holds a lot of data.

Similar Messages

  • Need help on how to do this :

    This might be a little off topic, but since it
    invovles a cf app, I thought I would post here for
    help.
    The problem I am having seems simple enough, but I cannot get
    it to work.
    My form contains two radio buttons and two input
    fields.
    Button 1 corresponds to field 1 and button 2
    corresonpds to field 2.
    One of the buttons must be select and I have
    javascript to check for that. Now here is my problem :
    If button 1 is selected, then field 1 must be filled
    in, and if button 2 is selected, then field 2 must be
    filled in.
    I have javascript to check for entries in the fields,
    but I cannot seem to combine both together to get them
    to work.
    So if they attempt to submit without checking one of
    the buttons, I display an error message. If they check
    button 1 and do not fill in field 1 and attempt to
    submit, then I need to display an alert (error
    message), same for button 2 and field 2.
    Can someone please help and show me how to do this ?
    Thanks

    quote:
    Originally posted by:
    trojnfn
    Can somebody please help me with this ?
    Writing down the requirements in english is a good way to go
    about it. Reading your first post I would understand your
    requirements to be
    1. if they attempt to submit without checking one of the
    buttons, I display an error message.
    2. If they check button 1 and do not fill in field 1 and
    attempt to submit, then I need to display an alert (error
    message)
    3. Repeat #2 for button 2 and field 2
    In psuedo-code that might translate to
    if (neither button is checked) {
    display error message
    else if (button1 is checked and field1 is empty) {
    display an error message
    else if (button2 is checked and field2 is empty) {
    display an error message
    else {
    everything is okay. submit the form
    Then translate that into javascript. The code needs some
    extra work like trimming values, but its a good starting point.
    I'll leave the rest up to you.
    <script language="javascript">
    // code assumes your form fields have the unique id's
    'button1' , 'button2' , 'field1', 'field2'.
    function validateForm(buyer_form) {
    //determine if buttons 1 and 2 are checked
    var isButton1Checked =
    document.getElementById('button1').checked;
    var isButton2Checked =
    document.getElementById('button2').checked;
    //get the values of fields 1 and 2
    var field1Value = document.getElementById('field1').value;
    var field2Value = document.getElementById('field2').value;
    //if neither button is checked
    if (!isButton1Checked && !isButton2Checked) {
    alert("Please Indicate whether you wish to send a NOR letter
    to this supplier, or not");
    //if button 1 is checked but field 1 is empty
    else if (isButton1Checked && field1Value == "") {
    alert("When button 1 is checked, you must enter a value in
    Field 1");
    //if button 2 is checked but field 2 is empty
    else if (isButton2Checked && field2Value == "") {
    alert("When button 2 is checked, you must enter a value in
    Field 2");
    //if okay, submit the form
    else {
    buyer_form.submit();
    </script>
    If you haven't already, you should familiarize yourself with
    DOM javascript. Elements should have a unique ID so they can be
    accessed using:
    document.getElementById('theIDOfTheElementYouWant'); Note, element
    ID is not the same as "name".
    http://www.w3schools.com/htmldom/met_doc_getelementbyid.asp

  • Need help in resolving the below error - SQL statement to execute cannot be

    Here is my CO as below , which creates a callable statement.
    try {
    OAApplicationModule oaapplicationmodule = pageContext.getApplicationModule(webBean);
    OADBTransactionImpl t = (OADBTransactionImpl)oaapplicationmodule.getOADBTransaction();
    OracleCallableStatement proc = (OracleCallableStatement)t.createCallableStatement(lquery, -1);
    proc.execute();
    t.commit();
    catch(SQLException sqlexception)
    throw OAException.wrapperException(sqlexception);
    After running the page , getting the below error ... ( Please find the below error stack )
    I reffered the developement guide but did not get helpful things.
    Please provide me any clues on the same.
    Regards Raghu
    -- Error Stack ---------------------------------------------------------
    Error Page
    Exception Details.
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27123: SQL error during call statement preparation. Statement: null
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1145)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1408)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2637)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    ## Detail 0 ##
    java.sql.SQLException: SQL statement to execute cannot be empty or null
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
         at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1138)
         at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1054)
         at oracle.jbo.server.DBTransactionImpl.createCallableStatement(DBTransactionImpl.java:3033)
         at cisco.oracle.apps.xxchr.element.server.webui.XXCHRElementSetSearchCO.processFormRequest(XXCHRElementSetSearchCO.java:343)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    java.sql.SQLException: SQL statement to execute cannot be empty or null
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
         at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1138)
         at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1054)
         at oracle.jbo.server.DBTransactionImpl.createCallableStatement(DBTransactionImpl.java:3033)
         at cisco.oracle.apps.xxchr.element.server.webui.XXCHRElementSetSearchCO.processFormRequest(XXCHRElementSetSearchCO.java:343)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    Edited by: Raghu on Sep 14, 2010 2:58 AM

    check the code pasted by me again
    Connection conn = pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection();
    Connection conn = oaapplicationmodule.getOADBTransaction().getJdbcConnection(); //Right oneThanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to rewrite this SQL statement

    I have tableA and tableB as below. The following query gets Max(Process_date) during month of january from the
    two tables tableA and tableB with different criteria
    I want to expand the following query to return  Max(Process_date) for BOTH current month(txn_date=entire jan2013) and prior month(txn_date= entire dec2013)
    Is it possible? If so how can I modify this query to return MAX(PROCESS_DATE) for current and prior months in single query.
    SELECT MAX(process_date)  AS curr_month_amount FROM
      SELECT process_date AS process_date,
             amount1 AS amount
      FROM   tableA
      WHERE  id = 1 AND
             process_date = (SELECT MAX(process_date)
                      FROM tableA
                     WHERE id = 1  and txn_date between TO_DATE('01-JAN-2013','dd-mon-yyyy') and TO_DATE('31-JAN-2013', 'dd-mon-yyyy')
            AND amount1 = 0
          UNION
      SELECT MAX(process_date) AS process_date,
             0 AS amount
      FROM   tableB
      WHERE id = 1 AND txn_code = 'B' and  txn_date between TO_DATE('01-JAN-2013','dd-mon-yyyy') and TO_DATE('31-JAN-2013', 'dd-mon-yyyy')
    future state of the sql
    Single sql statement a) should look at txn_date between 1/1/2013 - 1/31/2013 to return max(process_date) for current month
                         b) should look at txn_date between 12/1/2012 - 12/31/2012 to return max(process_date) for prior month
    NOTE:-( i want to pass current_month_end date 1/31/2013 to this sql so it will calculate for current and prior months)
    expected output
    ***************:   For id=1 in the modified query,
       prior month max(process_date) should be    1/19/2013
       current month max(process_date) should be   1/15/2012
         For id=5 in the modified query
       prior month max(process_date) should be   NULL
       current month max(process_date) should be  1/16/2013
    SQL to create TableA and TableB  with insert statements( txn_date column not included)
    CREATE table tableA
    id   NUMBER,
    process_date  DATE,
    amount1         NUMBER,
    txn_code VARCHAR2(1),
    txn_date DATE
    Create table tableB
    ( id  NUMBER,
    process_date DATE,
    amount2         NUMBER,
    txn_code VARCHAR2(1),
    txn_date DATE
    INSERT INTO tableA
    ( id, process_date, amount1, txn_code, txn_date )
    values
    ( 1, to_date('01/12/2013','mm/dd/yyyy'), 500, 'A',  to_date('01/15/2013','mm/dd/yyyy')  );
    INSERT INTO tableA
    ( id, process_date, amount1, txn_code, txn_date )
    values
    ( 1, to_date('01/13/2013','mm/dd/yyyy'), 100, 'A',  to_date('01/14/2013','mm/dd/yyyy'));
    INSERT INTO tableA
    ( id, process_date, amount1, txn_code , txn_date)
    values
    ( 1, to_date('01/14/2013','mm/dd/yyyy'), 0, 'A',    to_date('01/15/2013','mm/dd/yyyy'));  
    INSERT INTO tableB
    ( id, process_date, amount2, txn_code, txn_date)
    values
    ( 1, to_date('01/15/2013','mm/dd/yyyy'), 0, 'B', to_date('01/31/2013','mm/dd/yyyy'));
    INSERT INTO tableA
    ( id, process_date, amount1, txn_code, txn_date )
    values
    ( 1, to_date('12/01/2012','mm/dd/yyyy'), 500, 'A',  to_date('12/31/2012','mm/dd/yyyy')  );
    INSERT INTO tableA
    ( id, process_date, amount1, txn_code , txn_date)
    values
    ( 1, to_date('12/23/2012','mm/dd/yyyy'), 100, 'A',  to_date('12/14/2012','mm/dd/yyyy'));
    INSERT INTO tableA
    ( id, process_date, amount1, txn_code, txn_date )
    values
    ( 1, to_date('12/19/2012','mm/dd/yyyy'), 0, 'A',    to_date('12/15/2012','mm/dd/yyyy'));  
    INSERT INTO tableB
    ( id, process_date, amount2, txn_code, txn_date)
    values
    ( 1, to_date('12/15/2012','mm/dd/yyyy'), 0, 'C', to_date('12/31/2012','mm/dd/yyyy'));
    INSERT INTO tableA
    ( id, process_date, amount1, txn_code, txn_date )
    values
    ( 5, to_date('01/11/2013','mm/dd/yyyy'), 500, 'A', to_date('01/09/2013','mm/dd/yyyy')    );
    INSERT INTO tableA
    ( id, process_date, amount1, txn_code, txn_date )
    values
    (5, to_date('01/12/2013','mm/dd/yyyy'), 0, 'A', to_date('01/19/2013','mm/dd/yyyy'))
    INSERT INTO tableA
    ( id, process_date, amount1, txn_code, txn_date )
    values
    ( 5, to_date('01/15/2013','mm/dd/yyyy'), 10 , 'A', to_date('01/09/2013','mm/dd/yyyy'));  
    INSERT INTO tableB
    ( id, process_date, amount2, txn_code, txn_date)
    values
    ( 5, to_date('01/16/2013','mm/dd/yyyy'), 1, 'B', to_date('01/09/2013','mm/dd/yyyy'));
    INSERT INTO tableA
    ( id, process_date, amount1, txn_code, txn_date )
    values
    ( 5, to_date('12/11/2012','mm/dd/yyyy'), 500, 'A', to_date('12/09/2012','mm/dd/yyyy')    );
    INSERT INTO tableA
    ( id, process_date, amount1, txn_code, txn_date )
    values
    (5, to_date('12/12/2012','mm/dd/yyyy'), 0, 'A', to_date('12/19/2012','mm/dd/yyyy'))
    INSERT INTO tableA
    ( id, process_date, amount1, txn_code, txn_date )
    values
    ( 5, to_date('12/15/2012','mm/dd/yyyy'), 10 , 'A', to_date('12/09/2012','mm/dd/yyyy'));  
    INSERT INTO tableB
    ( id, process_date, amount2, txn_code, txn_date)
    values
    ( 5, to_date('12/16/2012','mm/dd/yyyy'), 1, 'C', to_date('12/09/2012','mm/dd/yyyy'));
    commit;

    Maybe
    SELECT id,
           month,
           MAX(process_date) AS curr_month_amount
      FROM (SELECT id,
                   process_date AS process_date,
                   amount1 AS amount,
                   TO_CHAR(txn_date,'mm') AS month
              FROM tableA
             WHERE (process_date,TO_CHAR(txn_date,'mm')) in
                     (SELECT MAX(process_date),TO_CHAR(txn_date,'mm') 
                        FROM tableA
                       WHERE txn_date between ADD_MONTHS(TO_DATE('01-JAN-2013','dd-mon-yyyy'),-1)
                                          AND TO_DATE('31-JAN-2013','dd-mon-yyyy')
                         AND amount1 = 0
                       GROUP BY TO_CHAR(txn_date,'mm')
               AND amount1 = 0
            UNION
            SELECT id,
                   MAX(process_date) AS process_date,
                   0 AS amount,
                   TO_CHAR(txn_date,'mm') AS month
              FROM tableB
             WHERE txn_code = 'B'
               AND txn_date between ADD_MONTHS(TO_DATE('01-JAN-2013','dd-mon-yyyy'),-1)
                                AND TO_DATE('31-JAN-2013','dd-mon-yyyy')
             GROUP BY id,TO_CHAR(txn_date,'mm')
    GROUP BY id,month
    ID
    MONTH
    CURR_MONTH_AMOUNT
    5
    01
    01/16/2013
    1
    12
    12/19/2012
    1
    01
    01/15/2013
    Regards
    Etbin

  • Really need help on how to write this program some 1 plz help me out here.

    i am new to java and i confused on how to be writing this program.
    i have completed the Part 1 but i am stuck on Part 2 & 3 so it would would be really great if any 1 could help me out on how to write the program.
    Part I
    An algorithm describes how a problem is solved in terms of the actions to be executed, and it specifies the order in which the actions should be executed. An algorithm must be detailed enough so that you can "walk" through the algorithm with test data. This means the algorithm must include all the necessary calculations.
    Here is an algorithm that calculates the cost of a rectangular window. The
    total cost of a window is based on two prices; the cost of the glass plus the cost of the metal frame around the glass. The glass is 50 cents per
    square inch (area) and the metal frame is 75 cents per inch (perimeter).
    The length and width of the window will be entered by the user. The
    output of the program should be the length and width (entered by the user)
    and the total cost of the window.
    FORMULAS:
    area = length times width perimeter = 2 times (length plus width)
    Here is the corresponding algorithm:
    read in the length of the window in inches
    read in the width of the window in inches
    compute the area
    compute the cost of the glass (area times 50 cents)
    compute the perimeter
    compute the cost of the frame (perimeter times 75 cents)
    compute the total cost of the window (cost of glass plus cost of frame)
    display the length, width and total cost
    The next step would be to "desk check" the algorithm. First you would need to make up the "test data". For this algorithm, the test data would involve making up a length and a width, and then calculating the cost of the window based on those values. The results are computing by hand or using a calculator. The results of your test data are always calculated before translating your algorithm into a programming language. Here is an example of the test data for the problem given:
    length = 10
    width = 20
    area = 200, glass cost= 100.00 (area times 50 cents)
    perimeter = 60, frame cost = 45.00 (perimeter times 75 cents)
    total cost =145.00
    Once the test data is chosen, you should "walk" through the algorithm using the test data to see if the algorithm produces the same answers that you obtained from your calculations.
    If the results are the same, then you would begin translating your algorithm into a programming language. If the results are not the same, then you would attempt to find out what part of the algorithm is incorrect and correct it. It is also
    necessary to re-check your hand calculations.
    Each time you revise your algorithm, you should walk through it with your test data again. You keep revising your algorithm until it produces the same answers as your test data.
    ?Now write and submit a Java program that will calculate the cost of a rectangular window according to the algorithm explained. Be sure to prompt for input and label your output.?
    Part II
    Write, compile and execute a Java program that displays the following prompts:
    Enter an integer.
    Enter a second integer
    Enter a third integer.
    Enter a fourth integer.
    After each prompt is displayed, your program should use the nextint method of the Scanner class to accept a number from the keyboard for the displayed
    prompt. After the fourth integer has been entered, your program should calculate and display the average of the four integers and the value of the first integer entered raised to the power of the second integer entered. The average and result of raising to a power should be included in an appropriate messages
    (labels).
    Sample Test Data:
    Set 1: 100 100 100 100
    Set 2: 100 0 100 0
    Be sure to write an algorithm first before attempting to write the Java code. Walk through your algorithm with test data to be sure it works as anticipated.
    Part III
    Repeat Part lI but only calculate the average, not the power. This time, make sure to use the same variable name, number, for each of the four numbers input. Also use the variable sum for the sum of the numbers. (Hint: To do this, you may use the statement sum = sum + number after each number is read.)
    For Part 1 this is what i got
    import java.util.Scanner;
    public class Window
         public static void main(String[] args)
              double length, width, glass_cost, perimeter, frame_cost, area, total;
              Scanner keyboard = new Scanner (System.in);
              System.out.println("Enter the length of the window in inches");
              length = keyboard.nextInt();
              System.out.println("Enter the width of the window in inches");
              width = keyboard.nextInt();
              area = length * width;
              glass_cost = area * .5;
              perimeter = 2 * (length + width);
              frame_cost = perimeter * .75;
              total = glass_cost + frame_cost;
                   System.out.println("The Length of the window is " + length + "inches");
                   System.out.println("The Width of the window is " + length + "inches");
                   System.out.println("The total cost of the window is $ " + total);
         Enter the length of the window in inches
         5
         Enter the width of the window in inches
         8
         The Length of the window is 5.0inches
         The Width of the window is 5.0inches
         The total cost of the window is $ 39.5
    Press any key to continue . . .
    Edited by: Adhi on Feb 24, 2008 10:33 AM

    Adhi wrote:
    i am new to java and i confused on how to be writing this program.
    i have completed the Part 1 but i am stuck on Part 2 & 3 so it would would be really great if any 1 could help me out on how to write the program.Looks like homework to me.
    What have you written so far? Post it.
    Part I
    An algorithm describes how a problem is solved in terms of the actions to be executed, and it specifies the order in which the actions should be executed. An algorithm must be detailed enough so that you can "walk" through the algorithm with test data. This means the algorithm must include all the necessary calculations.
    Here is an algorithm that calculates the cost of a rectangular window. The
    total cost of a window is based on two prices; the cost of the glass plus the cost of the metal frame around the glass. The glass is 50 cents per
    square inch (area) and the metal frame is 75 cents per inch (perimeter).
    The length and width of the window will be entered by the user. The
    output of the program should be the length and width (entered by the user)
    and the total cost of the window.
    FORMULAS:
    area = length times width perimeter = 2 times (length plus width)
    Here is the corresponding algorithm:
    read in the length of the window in inches
    read in the width of the window in inches
    compute the area
    compute the cost of the glass (area times 50 cents)
    compute the perimeter
    compute the cost of the frame (perimeter times 75 cents)
    compute the total cost of the window (cost of glass plus cost of frame)
    display the length, width and total cost
    The next step would be to "desk check" the algorithm. First you would need to make up the "test data". For this algorithm, the test data would involve making up a length and a width, and then calculating the cost of the window based on those values. The results are computing by hand or using a calculator. The results of your test data are always calculated before translating your algorithm into a programming language. Here is an example of the test data for the problem given:
    length = 10
    width = 20
    area = 200, glass cost= 100.00 (area times 50 cents)
    perimeter = 60, frame cost = 45.00 (perimeter times 75 cents)
    total cost =145.00
    Once the test data is chosen, you should "walk" through the algorithm using the test data to see if the algorithm produces the same answers that you obtained from your calculations.
    If the results are the same, then you would begin translating your algorithm into a programming language. If the results are not the same, then you would attempt to find out what part of the algorithm is incorrect and correct it. It is also
    necessary to re-check your hand calculations.
    Each time you revise your algorithm, you should walk through it with your test data again. You keep revising your algorithm until it produces the same answers as your test data.
    &#147;Now write and submit a Java program that will calculate the cost of a rectangular window according to the algorithm explained. Be sure to prompt for input and label your output.&#148;
    Part II
    Write, compile and execute a Java program that displays the following prompts:
    Enter an integer.
    Enter a second integer
    Enter a third integer.
    Enter a fourth integer.
    After each prompt is displayed, your program should use the nextint method of the Scanner class to accept a number from the keyboard for the displayed
    prompt. After the fourth integer has been entered, your program should calculate and display the average of the four integers and the value of the first integer entered raised to the power of the second integer entered. The average and result of raising to a power should be included in an appropriate messages
    (labels).
    Sample Test Data:
    Set 1: 100 100 100 100
    Set 2: 100 0 100 0
    Be sure to write an algorithm first before attempting to write the Java code. Walk through your algorithm with test data to be sure it works as anticipated.So this is where you actually have to do something. My guess is that you've done nothing so far.
    Part III
    Repeat Part lI but only calculate the average, not the power. This time, make sure to use the same variable name, number, for each of the four numbers input. Also use the variable sum for the sum of the numbers. (Hint: To do this, you may use the statement sum = sum + number after each number is read.)Man, this specification writes itself. Sit down and start coding.
    One bit of advice: Nobody here takes kindly to lazy, stupid students who are just trying to con somebody into doing their homework for them. If that's you, better have your asbestos underpants on.
    %

  • I need help on how to fix this

    Ok, ive tried everything...
    My comp crashed and at the same time so did my ipod 4th gen. it was chaos so i didnt have the software on my comp.
    What happened was my ipod froze and i reset it and it came up with a sad face. Sometimes it comes up with a folder with the esclamation point or a battery sign.
    I set it in disk mode and tried to install it and it didnt work. can i send this in or can somebody help me with it
    4th Generation   Windows XP  

    Hello,
    If a sad iPod icon or an exclamation point and folder icon appears on your iPod’s screen, or with sounds of clicking or HD whirring, it is usually the sign of a hard drive problem and you have the power to do something about it now. Your silver bullet of resolving your iPod issue – is to restore your iPod to factory settings.
    http://docs.info.apple.com/article.html?artnum=60983
    If you're having trouble, try these steps at different levels one at a time until the issue is resolved. These steps will often whip your iPod back into shape.
    Make sure you do all the following “TRYs”
    A. Try to wait 30 minutes while iPod is charging.
    B. Try another FireWire or USB through Dock Connector cable.
    C. Try another FireWire or USB port on your computer .
    D. Try to disconnect all devices from your computer's FireWire and USB ports.
    E. Try to download and install the latest version of iPod software and iTunes
    http://www.apple.com/ipod/download/
    http://www.apple.com/itunes/download/
    F. Try these five steps (known as the five Rs) and it would conquer most iPod issues.
    http://www.apple.com/support/ipod/five_rs/
    G. Try to put the iPod into Disk Mode if it fails to appear on the desktop
    http://docs.info.apple.com/article.html?artnum=93651
    If none of these steps address the issue, you may need to go to Intermediate level listed below in logical order. Check from the top of the lists to see if that is what keeping iPod from appearing on your computer in order for doing the Restore.
    Intermediate Level
    A. Try to connect your iPod with another computer with the iPod updater pre-installed.
    B. Still can’t see your iPod, put it in Disk Mode and connect with a computer, instead of doing a Restore on iPod Updater. Go and format the iPod instead.
    For Mac computer
    1. Open the disk utility, hope your iPod appears there (left hand side), highlight it
    2. Go to Tab “Partition”, click either “Delete” or “Partition”, if fails, skip this step and go to 3
    3. Go to Tab “Erase” , choose Volume Format as “MAC OS Extended (Journaled), and click Erase, again if fails, skip it and go to 4
    4. Same as step 3, but open the “Security Options....” and choose “Zero Out Data” before click Erase. It will take 1 to 2 hours to complete.
    5. Eject your iPod and do a Reset
    6. Open the iPod Updater and click “Restore”
    For Window computer
    Go to folder “My Computer”
    Hope you can see your iPod there and right click on the iPod
    Choose “Format”. Ensure the settings are at “Default” and that “Quick Format” is not checked
    Now select “Format”
    Eject your iPod and do a Reset
    Open the iPod Updater and click “Restore”
    In case you do not manage to do a “Format” on a window computer, try to use some 3rd party disk utility software, e.g.“Partition Magic”.
    C. Windows users having trouble with their iPods should locate a Mac user. In many cases when an iPod won't show up on a PC that it will show up on the Mac. Then it can be restored. When the PC user returns to his computer the iPod will be recognized by the PC, reformatted for the PC, and usable again. By the way, it works in reverse too. A Mac user often can get his iPod back by connecting it to a PC and restoring it.
    Tips
    a. It does not matter whether the format is completed or not, the key is to erase (or partly) the corrupted firmware files on the Hard Drive of the iPod. After that, when the iPod re-connected with a computer, it will be recognized as an fresh external hard drive, it will show up on the iPod updater.
    b. It is not a difficult issue for a Mac user to find a window base computer, for a PC user, if they can’t find any Mac user, they can go to a nearest Apple Shop for a favor.
    c. You may need to switch around the PC and Mac, try to do several attempts between “Format” and “Restore”
    http://discussions.apple.com/thread.jspa?messageID=2364921&#2364921
    Advance Level
    A. Diagnostic mode solution
    If you have tried trouble shooting your iPod to no avail after all the steps above, chances are your iPod has a hardware problem. The iPod's built-in Diagnostic Mode is a quick and easy way to determine if you have a "bad" iPod.
    You need to restart your iPod before putting it into Diagnostic Mode. Check that your hold switch is off by sliding the switch away from the headphone jack. Toggle it on and off to be safe.
    Press and hold the following combination of buttons simultaneously for approximately 10 seconds to reset the iPod.
    iPod 1G to 3G: "Menu" and "Play/Pause"
    iPod 4G+ (includes Photo, Nano, Video, and Mini): "Menu" and "Select"
    The Apple logo will appear and you should feel the hard drive spinning up. Press and hold the following sequence of buttons:
    iPod 1G to 3G: "REW", "FFW" and "Select"
    iPod 4G+ (includes Photo, Nano, Video, and Mini): "Back" and "Select"
    You will hear an audible chirp sound (3G models and higher) and the Apple logo should appear backwards. You are now in Diagnostic Mode. Navigate the list of tests using "REW" and "FFW". The scroll wheel will not function while in diagnostic mode. For further details on Diagnostic mode can be found at http://www.methodshop.com/mp3/ipodsupport/diagnosticmode/
    Try to do the 5in1, HDD R/W and HDD scan tests. Some successful cases have been reported after the running the few tests under the Diagnostic mode. In case it does not work in your case, and the scan tests reports show some errors then it proves your iPod has a hardware problem and it needs a repairing service.
    B. Format your iPod with a start disk
    I have not tried this solution myself, I heard that there were few successful cases that the users managed to get their iPod (you must put your iPod in disk mode before connecting with a computer) mounted by the computer, which was booted by a system startup disk. For Mac, you can use the Disk Utility (on the Tiger OS system disk), for PC user, you can use the window OS system disk. Try to find a way to reformat your iPod, again it does not matter which format (FAT32, NTFS or HFS+) you choose, the key is to erase the corrupted system files on the iPod. Then eject your iPod and do a Reset to switch out from Disk Mode. Reboot your computer at the normal way, connect your iPod back with it, open the iPod updater, and hopefully your iPod will appear there for the Restore.
    If none of these steps address the issue, your iPod may need to be repaired.
    Consider setting up a mail-in repair for your iPod http://depot.info.apple.com/ipod/
    Or visit your local Apple Retail Store http://www.apple.com/retail/
    In case your iPod is no longer covered by the warranty and you want to find a second repairing company, you can try iPodResQ at your own risk
    http://www.ipodresq.com/index.php
    Just in case that you are at the following situation
    Your iPod warranty is expired
    You don’t want to pay any service charges
    You are prepared to buy a new one
    You can’t accept the re-sell value of your broken iPod
    Rather than leave your iPod as paper-weight or throw it away.
    You can try the following, but again, only do it as your last resort and at your own risk.
    Warning ! – It may or may not manage to solve your problem, and with a risk that you may further damage your iPod, which end up as an expensive paper weight or you need to pay more higher repairing cost. Therefore, please re-consider again whether you want to try the next level
    Last Resort Level
    1. . Disconnecting the Hard Drive and battery inside the iPod – Warning !! Your iPod warranty will be waived once you open the iPod.
    In Hong Kong there are some electronic shops offering an iPod service for Sad iPod, the first thing they do is to open up the iPod’s case and disconnecting the battery and the Hard Drive from the main board of the iPod. Wait for 5-10 minutes and reconnecting them back. The reason behind which I can think of is to do a fully reset of a processor of the iPod. In case you want do it itself and you believe that you are good on fixing the electronics devices and have experience to deal with small bits of electronic parts, then you can read the following of how to open the iPod case for battery and HDD replacement (with Quicktimes)
    http://eshop.macsales.com/tech_center/index.cfm?page=Video/directory.html
    2.Press the reset button on the Hard Drive inside the iPod – Suggestion from Kill8joy
    http://discussions.apple.com/thread.jspa?messageID=2438774#2438774
    Have I tried these myself? No, I am afraid to do it myself as I am squeamish about tinkering inside electronic devices, I have few experiences that either I broke the parts (which are normally tiny or fragile) or failed to put the parts back to the main case. Therefore, I agree with suggestion to have it fixed by a Pro.
    2. Do a search on Google and some topics on this discussion forum about “Sad iPod”
    What should I do with my iPod? Send it or keep it?
    http://discussions.apple.com/thread.jspa?threadID=469080&tstart=0
    Strange error on iPod (probably death)
    http://discussions.apple.com/thread.jspa?threadID=435160&start=0&tstart=0
    Sad Face on iPod for no apparent reason
    http://discussions.apple.com/thread.jspa?threadID=336342&start=0&tstart=0
    Meeting the Sad iPod icon
    http://askpang.typepad.com/relevanthistory/2004/11/meeting_thesad.html#comment-10519524
    Sad faced iPod, but my computer won’t recognize it?
    http://discussions.apple.com/thread.jspa?messageID=2236095#2236095
    iPod Photo: unhappy icon + warranty question
    http://discussions.apple.com/thread.jspa?messageID=2233746#2233746
    4th Gen iPod Users - are we all having the same problem?
    http://discussions.apple.com/message.jspa?messageID=2235623#2235623
    Low Battery, and clicking sounds
    http://discussions.apple.com/thread.jspa?messageID=2237714#2237714
    Sad faced iPod, but my computer won’t recognize it
    http://discussions.apple.com/thread.jspa?messageID=2242018#2242018
    Sad iPod solution
    http://discussions.apple.com/thread.jspa?threadID=412033&tstart=0
    Re: try to restore ipod and it says "can't mount ipod"
    http://discussions.apple.com/thread.jspa?threadID=443659&tstart=30
    iPod making clicking noise and is frozen
    http://discussions.apple.com/thread.jspa?messageID=2420150#2420150
    I am not suggesting that you should follow as well, but just read them as your reference. You are the person to make the call.

  • I have a small problem i need help on how to fix this

    i downloaded a program with firefox "MP3Rocket version 6.0.6 Pro" when i want to start it up the program this happons:
    Copy Raport
    MP3Rocket version 6.0.6 Pro
    Java version 1.7.0_05 from Oracle Corporation
    Windows 7 v. 6.1 on x86
    Free/total memory: 15129208/16252928
    com.limegroup.gnutella.gui.GUILoader$StartupFailedException: file [vorbisspi.jar] has hash of [C02D434882D9212EE92A4D306FE01591] instead of expected [D840DAF0B8D76AE8F3B134647C38DF25]
    at com.limegroup.gnutella.gui.GUILoader.verifyHashes(Unknown Source)
    at com.limegroup.gnutella.gui.GUILoader.sanityCheck(Unknown Source)
    at com.limegroup.gnutella.gui.GUILoader.load(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.limegroup.gnutella.gui.Main.main(Unknown Source)
    STARTUP ERROR!
    FILES IN CURRENT DIRECTORY:
    C:\Program Files (x86)\MP3 Rocket\gamespro1.zip
    LAST MODIFIED: 1304444080000
    SIZE: 90373
    C:\Program Files (x86)\MP3 Rocket\install.exe
    LAST MODIFIED: 1339081792000
    SIZE: 12873652
    C:\Program Files (x86)\MP3 Rocket\lib
    LAST MODIFIED: 1340012736772
    SIZE: 16384
    C:\Program Files (x86)\MP3 Rocket\License.txt
    LAST MODIFIED: 1304444080000
    SIZE: 17719
    C:\Program Files (x86)\MP3 Rocket\lua5.1.dll
    LAST MODIFIED: 1340012503649
    SIZE: 325960
    C:\Program Files (x86)\MP3 Rocket\MP3 Rocket (Minimized).lnk
    LAST MODIFIED: 1340012727855
    SIZE: 1931
    C:\Program Files (x86)\MP3 Rocket\MP3List.exe
    LAST MODIFIED: 1304529678000
    SIZE: 9838592
    C:\Program Files (x86)\MP3 Rocket\MP3Rocket.exe
    LAST MODIFIED: 1304444080000
    SIZE: 175104
    C:\Program Files (x86)\MP3 Rocket\MP3Rocket.ico
    LAST MODIFIED: 1304529676000
    SIZE: 33982
    C:\Program Files (x86)\MP3 Rocket\player.swf
    LAST MODIFIED: 1304444080000
    SIZE: 91375
    C:\Program Files (x86)\MP3 Rocket\radiopro1.zip
    LAST MODIFIED: 1304444080000
    SIZE: 165732
    C:\Program Files (x86)\MP3 Rocket\resource
    LAST MODIFIED: 1340012656143
    SIZE: 4096
    C:\Program Files (x86)\MP3 Rocket\root
    LAST MODIFIED: 1340012655983
    SIZE: 0
    C:\Program Files (x86)\MP3 Rocket\swfobject.js
    LAST MODIFIED: 1304444080000
    SIZE: 6887
    C:\Program Files (x86)\MP3 Rocket\tvpro7.zip
    LAST MODIFIED: 1304444080000
    SIZE: 311081
    C:\Program Files (x86)\MP3 Rocket\Uninstall
    LAST MODIFIED: 1340012503649
    SIZE: 4096
    C:\Program Files (x86)\MP3 Rocket\uninstall.exe
    LAST MODIFIED: 1340012736800
    SIZE: 130597
    C:\Program Files (x86)\MP3 Rocket\uninstall.ico
    LAST MODIFIED: 1304444080000
    SIZE: 33982
    C:\Program Files (x86)\MP3 Rocket\xml.war
    LAST MODIFIED: 1304529676000
    SIZE: 17356
    ? help ?

    hello, this is an issue with the program and/or java & not related to firefox, so we probably can't help you with that...

  • Need help understanding how to resolve this XMLP Report Definition error

    Getting error on only 1 database but is of course is the one for an important deal. Going to Reporting Tools>XML Publisher>Report Definition and querying for Report Name HRS_INT_LET we get errors.
    File associated with template definition is not found in the database. (235,77)
    File object associated with template defintiion is not found in the database, therefore the report and/or template definition is not valid.  Please check consistency of objects.
    Next error message:
    Error in PeopleCode ScrollSelect processing. (2,213) PSXPRPTDEFN_WRK.FUNCLIB.FieldFormula  Name:LoadTemplateDefn  PCPC:37323  Statement:542
    Called from:PSXPRPTDEFN_WRK.FUNCLIB.FieldFormula  Name:LoadReportDefn  Statement:601
    Called from:PSXPRPTDEFN_WRK.FUNCLIB.FieldFormula  Name:SelectReportDefn  Statement:740
    Called from:PSXPRPTDEFN.GBL.PostBuild  Statement:36
    A SQL error occurred during processing of the PeopleCode ScrollSelect (or ScrollSelectNew, RowScrollSelect, RowScrollSelectNew) built-in function.
    This error may have been described by a preceding message.
    Examine the error messages and the PeopleCode program containing the ScrollSelect call to determine the cause of the error.
    Edited by: user702257 on Feb 3, 2010 8:24 AM

    Hey did anyone reply or have a similar problem.. ??
    but with 3 Error Messages, the first one is:
    1st Error:
    SQL error.stmt#:651 Error Position:2010 Return:904 - ORA-00904: "CUSTMERNAME":invalid identifier
    2nd Error:
    SELECT T1, T2, ETC........
    3rd Error:
    Error in PeopleCode ScrollSelect processing. (2,213) At INV.TRANS.FieldChange trans_qry PCPC:1719 Statement: 67
    A SQL error ocurred during processing of the PeopleCode ScrollSelect (or ScrollSelectNew, RowScrollSelect, RowScrollSelectNow) built-in function.
    This error may have been described by preceding message.
    Examine the error message and the PeopleCode program containing the ScrollSelect call to determine the cause of the error.
    does any one know or had this error in particular?
    Thanks
    George

  • Every time i try to press new tab nothing happens it wont open, i need help on how to fix this

    I'm unable to open a new tab in Firefox. I've tried restarting Firefox, pressing Ctrl t, and going to file and pressing new tab. but none of it is working. does anyone know ow to fix this

    This issue can be caused by an extension that isn't working properly.
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe Mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    You can use the SearchReset extension to reset some preferences to the default values.
    *https://addons.mozilla.org/firefox/addon/searchreset/
    Note that the SearchReset extension only runs once and then uninstalls automatically, so it won't show on the "Firefox > Add-ons" page (about:addons).

  • How to Tuning this sql statement

    hi my friend:
                            SELECT    ie.ImportEntityAutoID,
                                        ie.ImportRawDataAutoID,
                                        ie.Amount,
                                        s.NAME AS StatusName,
                                        ir.SourceLocation AS SourceLocation,
                                        ie.ErrorMessage AS ErrorMessage,
                                        famis.PROJECT_CODE,
                                        famis.PROJECT_TITLE
                              FROM      dbo.ImportEntity ie   
                      INNER JOIN tblBatch B ON ie.BatchGuid = B.BatchGuid                      
                                        INNER JOIN dbo.ImportRawData ir ON ie.ImportRawDataAutoID
    = ir.ImportRawDataAutoID
                                        INNER JOIN dbo.ImportRawData_Famis famis ON ie.ImportRawDataAutoID
    =                          famis.ImportRawDataAutoID         
                                        LEFT OUTER JOIN dbo.Status s ON ( ie.StatusID
    = s.StatusID
    AND s.StatusTypeID = 35 --Import Entity Status                                                                        
                              WHERE     ie.EntityType <> 'Unknown'
             AND ie.[StatusID] IN ( 3, 5, 6 ) ----3: Pending; 5: Failed; 6: Cancel
                                        AND ( 0 = 0
                                              OR ie.StatusID
    = 0
                                        AND ie.Amount >= -99999999999999.9999 AND ie.Amount
    <= 99999999999999.9999 ;
           the ImportEntity TABLE has 5 milion record AND the value of entitytype COLUMN equal 'Unknown' IS more THEN 3 milion,
           statusid equal (3,5,6) Probably 2 milion. I had following index:
           table ImportEntity:
              clustered_index:ImportRawDataAutoID
              non-CLUSTERED INDEX IX_batchguid ON BatchGuid
              non-CLUSTERED INDEX IX_ImportRawDataAutoID ON ImportRawDataAutoID
              non-CLUSTERED INDEX IX_StatusID ON StatusID
              non-CLUSTERED INDEX IX_EntityType ON EntityType
           AND tblBatch has ONLY two records
           ImportRawData_Famis has 5 milion recors AND ImportRawDataAutoID IS its clustered index COLUMN
           ImportRawData has 5 milion recors AND ImportRawDataAutoID IS its clustered index COLUMN
           the query require 180 SECOND.how can i tuning this statment.

    hi
    Visakh16
         I do just as you say. but I understand the execution plan and can you give me some advice about procedure
    tuning and look the execution plan、clean execution plan and so on.
    thank you very much!
    ming

  • How to optimize this SQL. Help needed.

    Hi All,
    Can you please help with this SQL:
    SELECT /*+ INDEX(zl1 zipcode_lat1) */
    zl2.zipcode as zipcode,l.location_id as location_id,
    sqrt(POWER((69.1 * ((zl2.latitude*57.295779513082320876798154814105) - (zl1.latitude*57.295779513082320876798154814105))),2) + POWER((69.1 * ((zl2.longitude*57.295779513082320876798154814105) - (zl1.longitude*57.295779513082320876798154814105)) * cos((zl1.latitude*57.295779513082320876798154814105)/57.3)),2)) as distance
    FROM location_atao l, zipcode_atao zl1, client c, zipcode_atao zl2
    WHERE zl1.zipcode = l.zipcode
    AND l.client_id = c.client_id
    AND c.client_id = 306363
    And l.appType = 'HOURLY'
    and c.milessearchzipcode >= sqrt(POWER((69.1 * ((zl2.latitude*57.295779513082320876798154814105) - (zl1.latitude*57.295779513082320876798154814105))),2) + POWER((69.1 * ((zl2.longitude*57.295779513082320876798154814105) - (zl1.longitude*57.295779513082320876798154814105)) * cos((zl1.latitude*57.295779513082320876798154814105)/57.3)),2))
    I tried to optimize it by adding country column in zipcode_atao table. So that we can limit the search in zipcode_atao table based on country.
    Any other suggestions.
    Thanks

    Welcome to the forum.
    Please follow the instructions given in this thread:
    How to post a SQL statement tuning request
    HOW TO: Post a SQL statement tuning request - template posting
    and add the nessecary details we need to your thread.
    Depending on your database version (the result of: select * from v$version; ):
    Have you tried running the query without the index-hint?
    Are your table (and index) statatistics up-to-date?

  • I'm new to SQL Server Integration Services and I need help on how to begin learning SSIS. Is there any training for it besides msdn?

    I'm new to SQL Server Integration Services and I need help on how to begin learning SSIS. Is there any training for it besides msdn?

    Check this thread where people have already given their suggestion on learning SSIS
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/f2cc1cf3-204d-454a-a189-47df87a3aa23/i-want-to-learn-ssis?forum=sqlintegrationservices
    I would suggest to go for You tube videos (type learn SSIS or begin SSIS step by step) you will get lot of good tutorials to start with.
    Happy Learning!!
    If this post answers your query, please click "Mark As Answer" or "Vote as Helpful".

  • I bought CS6 creative suite. As of now i need to work each application in separate separate system. Can any one please help me how to solve this problem.

    I bought CS6 creative suite. As of now i need to work each application in separate separate system. Can any one please help me how to solve this problem.
    I saw the below quote on Adobe forum
    "You may install software on up to two computers. These two computers can be Windows, Mac OS, or one each."
    If i install each application in single single system the system count is more than two. In this case, are we have any license issue? Please advice how the problem will solve?
    If possible please send the advise to my mail id: <Removed by Moderator>
    Thanks
    Uvaraj S

    I already answered that.  If you purchased a Suite then you can only install and activate it on two machines.  Even if you only insdtall one of the applications of that suite, it counts as one activation of the suite.  You cannot take the six or seven different applications that might be in a suite and install and activate them in six or seven different machines... only two machines.
    If your scenario will allow for it, one thing you can do is install the programs on all the different machines and only activate two of the machines at any given time.  If you need to activate a program on a third machine then you need to deactivate on one of the currently activate machines first so that you have an open activation to use again.  I do not remember if there is a limit to the total number of activations you can process for the life of the software.

  • All of my apps on my new ipad2 are not working. I had this iPad about 4 months and nothing bad has happened before this. I need help on how to make my apps stop crashing. All my built in apps are fine though.

    All of my apps on my new ipad2 are not working. I had this iPad about 4 months and nothing bad has happened before this. I need help on how to make my apps stop crashing. All my built in apps are fine though. WHATBCAN I DO TO MAKE MY APPS STOP CRASHING. I ALREADY TURNED IT OFF THEN ON AGAIN AN IT STILL CRASHES. HELPPP!!!!

    Try a reset. Hold the Sleep and Home button down for about 10 seconds until you see the Apple logo. Ignore the red slider.

  • SIR I NEED TO UNLOCK MY IPHONE 4 FOR FREE PLEASE HELP ME HOW I DO THIS...........

    SIR I NEED TO UNLOCK MY IPHONE 4 FOR FREE PLEASE HELP ME HOW I DO THIS..........

    Call your carrier and request it is generally the best idea.
    <Edited By Host>

Maybe you are looking for

  • CUCM 8.6 Call Forwarding to External Number Issue

    Hello, Call forwarding worked without problems, we could forward our phones to external numbers and everything was ok, when somebody called to my phone, I could  got the call to my cell phone. But now when I forward my phone to external number and tr

  • Inbound purchase order Acknowledgement for E-commerce Gateway

    Hello All, I am configuring EC gateway on 12.1 for PO. Am ok with the OUTBOUND but to my suprise I cannot find any process for inbound acknowlegdement from vendors. i.e after the PO has been sent out and he vendor acknowlegdes how do we relect that i

  • Header Mapping & Value Mapping in XI

    Hi All, I Request you to send me the documentation with screen shots about Header mapping and Value mapping. I am very thankful to you in advance. Regards, Nagarjuna.

  • String Comparision in JSTL

    have to do something like this if(product.equals("ABC")) { } else { Trying to use <c:choose> <c:when test="${product == 'ABC'}'"> ------ is this correct????? </c:when> <c:otherwise> </c:otherwise> </c:choose> thanks.

  • I use gmail. How do I block junk emails and spam or create filters to delete them

    I Use an I pad and iPhone for gmail . how do I block spam and unwanted commercial emails. can I set filters as I do when using my MacBook Pro? I don't see the same "more" bottom on these devices. Please help.