ResultSet returns information twice...eek

HI,
I am creating a database interrogation application and thought it would be good to use a JList to return the results so that I could then move on to a deeper level from there.
The issue I have is that I am getting the results returned twice. I cannot see where this loop is. Any thoughts?
public void itemStateChanged(ItemEvent b){
     if(box1.getSelectedIndex()==1){
          //search all
          try{
     ResultSet rs = db_statement.executeQuery("select * from staff");
     while (rs.next()) {
              listModel.addElement(""+rs.getString("Forename")+"\t  "+rs.getString("Surname")+"\n");
          }//end while
     }  // end try
     catch (Exception e){}
     p2.removeAll();                         
     p2.add(list);
     p2.add(selectedName);
     p2.add(detailButton);
}Thanks

I managed to debug. Does not look good. Appears to be called 8 times. The below information is repeated 8 times.
java.lang.Exception
at Unitest.itemStateChanged(Unitest.java:82)
at javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1161)
at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1218)
at javax.swing.JComboBox.contentsChanged(JComboBox.java:1265)
at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:100)
at javax.swing.DefaultComboBoxModel.setSelectedItem(DefaultComboBoxModel.java:88)
at javax.swing.JComboBox.setSelectedItem(JComboBox.java:551)
at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:597)
at javax.swing.plaf.basic.BasicComboPopup$ListMouseHandler.mouseReleased(BasicComboPopup.java:749)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:228)
at java.awt.Component.processMouseEvent(Component.java:5021)
at javax.swing.plaf.basic.BasicComboPopup$2.processMouseEvent(BasicComboPopup.java:452)
at java.awt.Component.processEvent(Component.java:4818)
at java.awt.Container.processEvent(Container.java:1525)
at java.awt.Component.dispatchEventImpl(Component.java:3526)
at java.awt.Container.dispatchEventImpl(Container.java:1582)
at java.awt.Component.dispatchEvent(Component.java:3367)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3359)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3074)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3004)
at java.awt.Container.dispatchEventImpl(Container.java:1568)
at java.awt.Window.dispatchEventImpl(Window.java:1581)
at java.awt.Component.dispatchEvent(Component.java:3367)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:191)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
This is on the following code (put it in one file to try to help me find the problem) import java.sql.*;
import java.io.DataInputStream;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.awt.*;
class Unitest extends JFrame implements ListSelectionListener,ItemListener{
     String[] type={"Select One","All","Forename","Surname"};
     JComboBox box1=new JComboBox(type);
     JPanel p1=new JPanel();
     JPanel p2=new JPanel();
     Connection db_connection;
     Statement db_statement;          
     DefaultListModel listModel = new DefaultListModel();
     JList list = new JList(listModel);
     Container content=this.getContentPane();
     public Unitest() {
          //super("Unitest");
          addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent e) {
                    dispose();
                    System.exit(0);
          try{               
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
               String url = "jdbc:odbc:"+"Uni1";
               db_connection = DriverManager.getConnection(url,"","");
               db_statement = db_connection.createStatement();
          catch(Exception ce){ce.printStackTrace();}
               content.setLayout(new FlowLayout());               
               box1.setMaximumRowCount(5);
               box1.addItemListener(this);
               p1.add(box1);
             //Create the list and put it in a scroll pane             
             list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
             list.addListSelectionListener(this);
             JScrollPane listScrollPane = new JScrollPane(list);
             list.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(),BorderFactory.createRaisedBevelBorder()));
             p1.add(list);
             content.add(p1);
          content.add(p2);
               public void itemStateChanged(ItemEvent b){                    
                    if(box1.getSelectedIndex()==1){
                         //search all
                         try{                    
               ResultSet rs = db_statement.executeQuery("select * from staff");
               while (rs.next()) {
               new Exception().printStackTrace(System.err);
                        listModel.addElement(""+rs.getString("Forename")+"\t  "+rs.getString("Surname")+"\n");
          }//end while
     }  // end try
                         catch (Exception e){}
                         p2.add(list);
               }// end if
          }// end itemStateChanged
          public void valueChanged(ListSelectionEvent ls) {}
     public static void main(String args[]) {
          System.out.println("Starting Unitest...");
          Unitest mainFrame = new Unitest();
          mainFrame.setSize(400, 400);
          mainFrame.setTitle("Unitest");
          mainFrame.setVisible(true);
}Fess

Similar Messages

  • GetColumns() returns columns twice!

    I am having a problem with the Oracle JDBC driver that is causing problems.
    Here is the snippett of code:
    DatabaseMetaData dbmd = con.getMetaData(null,null,tablename,null);
    ResultSet rs = dbmd.getColumns();
    Stepping through the resultset that is returned shows that the getColumns() method returned the columns twice!
    If the table has 4 columns then the resultset returns 8 rows with duplicates of each 'real' column in the table.
    Other info:
    using the thin driver for Oracle 8.1.6
    Can anyone help here?
    null

    I wish I could help you but I know little of table synonyms. The only thing close that I know of is the long table names in DB2/400 vs. the 10 character restricted system names. Could it be a driver shortcoming? What DB driver and database are you using? MAybe there's a better approach to your overall problem besides sysnonyms?
    Cliff

  • Can we proceed even if no ResultSet Returned In JDBC Sender Adapter ?

    Hi friends ,
                           My scenario  is  JDBC to RFC .  I am reading table using JDBC Sender Adapter  and i am passing values to RFC .
                          If my select Query has not returned  any row then it won't come to Pipeline right ?
                            What i want is
                          <b>  If no rows returned then call one RFC  to insert the remarks .
                            If rows found call another RFC  to insert the values </b>
                           How can i handle the Situtation ?
                          Expecting your reply asap
    Regards.,
    V.Rangarajan

    Hi Rangarajan,
    i answered your question and shown up a solution: If Connection Lost in JDBC or no resultset returned how to handle ?.
    Double postings makes it difficult for all involved people to inform theirselfes about the point of discussion.
    The polling sender adapter is doing nothing, if no rows selected. So how do want to send a message?
    You have to use the JDBC receiver adapter, invoke the message by a job in ERP, for example with a self written RFC or a proxy. You can decide at ERP side, which function module it to be called. Of coz there are other possibilities, for example to put the logic into a business process, but you wont have success with the sender adapter.
    Regards,
    Udo

  • Having trouble finding return information

    Would like to return my ipod touch, it is new and unused however the box has been opened.
    Apple does not provided clear return information for open box items for the UK.
    I would like to know whether I am able to return this item for a refund or store credit, or if I am able to exchange.

    Call Apple and ask.
    I typed "return" in the search bar of the Apple Store online and it explained the process.

  • Printing return information

    What is possibility in SAP in printing return information on the printed tag such as such as Sending Location, Receiving Destination, materials being shipped. Transaction code,path, steps etc. would be welcomed.

    This can be done thru configuring outputs for Returns.
    refer t.code NACZ and define a output procedure for Inbound deliveries and assign them to the concerned Inbound delivery.
    Regards.

  • How to extract data from a resultset returned by SQLX query

    Hi all,
    I'm doing a project in which I use SQLX query to extract data and format it into xml from an object-relational database, and return it to a windows application. But when the resultset is returned, I don't know how to extract and display the data from it. The datatype of returned data might be XmlType, but i don't know how to process it..Can anyone help? It's urgent.. Thanks a lot in advance...
    Joanne

    You can use XMLType.extract().

  • Resultset returns null while calling a DB2 stored procedure using hibernat

    Hi All ,
    I am trying to call a db2 stored proc with cursor open from my java code but it always returns me null results though it executes fine when I call the procedure from the command line
    Java code....................
    CallableStatement stmt3 = EyeHibernateApp.getHibernateSession().connection().prepareCall("{call answers_select_id( ? )}");
    stmt3.setString(1,20);
    stmt3.execute();
    ResultSet rs1 = stmt3.getResultSet();
    System.out.println("rs1 " + rs1); --> returns null
    procedure-------------
    CREATE PROCEDURE answers_select_id (IN question_id bigint )
    P1:BEGIN
    DECLARE cursor1 CURSOR WITH RETURN TO CLIENT FOR
    SELECT a.answer_id from answers as a where a.question_id = question_id;
    open cursor1;
    END P1;
    I am using the same java code with mysql stored procs . It works fine there but I assume open cursors in db2 stored proc is causing the problem . If I can help it , I need to maintain the same java code for mysql ad db2 . Please help me ...
    Thanks,
    Av~

    Hi,
    I am trying to do something like this but with Oracle stored procedure which returns an associate array and a cursor and these are defined as INOUT. I am not finding a way how to do it with editable row set. Can you plese list the steps used to make things work.
    Thanks.

  • Resultset returns null while calling a DB2 stored procedure using hibernate

    Hi All ,
    I am trying to call a db2 stored proc with cursor open from my java code but it always returns me null results though it executes fine when I call the procedure from the command line
    Java code....................
    CallableStatement stmt3 = EyeHibernateApp.getHibernateSession().connection().prepareCall("{call answers_select_id( ? )}");
    stmt3.setString(1,20);
    stmt3.execute();
    ResultSet rs1 = stmt3.getResultSet();
    System.out.println("rs1 " + rs1); --> returns null
    procedure-------------
    CREATE PROCEDURE answers_select_id (IN question_id bigint )
    P1:BEGIN
    DECLARE cursor1 CURSOR WITH RETURN TO CLIENT FOR
    SELECT a.answer_id from answers as a where a.question_id = question_id;
    open cursor1;
    END P1;
    I am using the same java code with mysql stored procs . It works fine there but I assume open cursors in db2 stored proc is causing the problem . If I can help it , I need to maintain the same java code for mysql ad db2 . Please help me ...
    Thanks,
    Av~

    Hi,
    I am trying to do something like this but with Oracle stored procedure which returns an associate array and a cursor and these are defined as INOUT. I am not finding a way how to do it with editable row set. Can you plese list the steps used to make things work.
    Thanks.

  • Problems when trying to return information for External Content Types in Sharepoint 2013

    This is my first post on the forum, until I tried on this problem but have not found anything.
    When trying to return the information from the external content displays the following error:
    Error retrieving data from mill. Administrators: query the server log for more information.
    I do not know what else to do...

    Hi,
    According to your post, my understanding is that you got an error when tried to return the information from the external content.
    Did the error occur when you created a new external content type or created a external list?
    You can check the steps with the following articles about how to create a external content type.
    http://lightningtools.com/bcs/creating-an-external-content-type-with-sharepoint-designer-2013/
    http://wyldesharepoint.blogspot.in/2012/12/sharepoint-2013-setting-up-external.html
    If the error occurred with the external list, you can check the steps with the following article.
    http://community.bamboosolutions.com/blogs/sharepoint-2013/archive/2013/01/08/how-to-create-external-data-column-in-sharepoint-2013.aspx
    You can also check the event log and ULS log to see if anything unexpected occurred.
    For SharePoint 2013, by default, ULS log is at      
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Resultset returning too many rows when using Group by

    Hello
    My problem is this
    I run the following query which uses a Group By
    sQury = "SELECT Distinct Searches.categoryId ,count(Searches.categoryId) AS NUMBER_OF_APPEARANCE" +
    " FROM Searches " +
    " GROUP BY Searches.categoryId ";
    When I run this query in Access the query returns 15 rows (since I have 15 products)
    When I run this query by opening Resultset I get 60 rows (Which are the number of records in Searches table)
    NOTE: the first 15 rows in the resultset are the 15 rows I got in access and after that I have something like null rows with no data inside (with causes real problems to my program
    I use the followin code in order to run the query
    public ResultSet m_resultSet = null;
    private Statement m_stat;
    private Connection m_conn;
    m_stat = m_conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    m_stat.execute(sql)
    m_resultSet = dbResultSet.m_stat.getResultSet();
    If any one see any problem with this please help

    Try removing distinct as well.
    (The above suggestion also makes sense as it is not possible to update a count. Even if it has no impact on the problem.)

  • Does restoreCompletedTransactions return information about subscriptions?

    Hi,
    This is what the StoreKitGuide says:
    Although nonconsumable products may be recovered using the built-in capabilities of Store Kit, subscriptions
    must be restored by your server. You are responsible for recording information about subscriptions and
    restoring them to users.
    Does it mean that restoreCompletedTransactions only returns products which are non-consumables?
    OR
    Does it mean that restoring of the content is the developer's responsibility? I understand this part as long as StoreKit will provide me a list of purchases made using this iTunes account.
    I have a subscription model and was planning to use restoreCompletedTransactions to get a list of subscriptions purchased by the user when they moved devices so that I can restore it on the new device. If StoreKit does not return me a list of purchases made using the iTunes account, how am I going to be able to validate the purchase?
    If someone has worked with subscriptions and has faced this issue, I would greatly appreciate your feedback.
    Thanks in advance,
    -TRS

    I have the same problem with recstoring subscriptions. And my question is identical to your post. Did you get any conclusion?
    Best Regards,
    Howard Wu

  • Safari asks if I want to resend information twice

    Everytime I go back to a page where I have entered any information I get the "Are you sure you want to resend dialog box?" twice. I click on the send link and then it pops up again and I have to click on send again. Any way to fix this?

    I want to confirm the problem. It is not related secure sites or the safari preferences choice. It happens in Safari 4. OSX 10.5.7. Always. Both on G5 and Intel. Does not happen on firefox or camino. It cannot be killed using the terminal command
    defaults write com.apple.Safari DebugConfirmTossingUnsubmittedFormText NO
    Yes this is a true bug and Apple needs to hear about it. Everyone annoyed by this send a bug report EVERY DAY to Apple until they fix it. It makes this browser unusable.

  • ResultSet returning nothing

                String sql = "SELECT id FROM users WHERE email = ? && password = ?";
                PreparedStatement pstmt = connection.prepareStatement (sql);
                // Set the values
                pstmt.setString (1, t_email.getText ()); //get the name
                pstmt.setInt (2, passHash ());
                rs = pstmt.executeQuery ();
                while (rs.next ())
                    int id = rs.getInt (1);
                    JOptionPane.showMessageDialog (login.this,"The id " + id + " exists.", "Connection Error",
                            JOptionPane.ERROR_MESSAGE);
                }Regardless of if I enter the correct information or incorrect information I'm not getting any result back to me, or at least none of my dialogs are displaying anything. Did I use the PrepareStatement correctly?

    Are you sure you are not swallowing some Exception?
    try
                // Load the JDBC driver
                ResultSet rs = null;
                String driverName = "com.mysql.jdbc.Driver"; // MySQL MM JDBC driver
                Class.forName (driverName);
                // Create a connection to the database
                serverName = "fedex.plastikracing.net";
                mydatabase = "web5_db1";
                url = "jdbc:mysql://" + serverName +  "/" + mydatabase; // a JDBC url
                dbuser = "web5_u1";
                dbpass = "password";
                connection = DriverManager.getConnection (url, dbuser, dbpass);
                Statement stmt = connection.createStatement ();
                String sql = "SELECT id FROM users WHERE email = ? AND password = ?";
                PreparedStatement pstmt = connection.prepareStatement (sql);
                // Set the values
                pstmt.setString (1, t_email.getText ()); //get the name
                pstmt.setInt (2, passHash ());
                rs = pstmt.executeQuery ();
                while (rs.next ())
                    int id = rs.getInt (1);
                    JOptionPane.showMessageDialog (login.this,"The id " + id + " exists.", "Connection Error",
                            JOptionPane.ERROR_MESSAGE);
                catch (SQLException e)
                    // Could not connect to the database
                    JOptionPane.showMessageDialog (login.this,"Error: " + e.getMessage (), "Connection Error",
                            JOptionPane.ERROR_MESSAGE);
                catch (ClassNotFoundException e)
                    // Could not find the database driver
                    JOptionPane.showMessageDialog (login.this,"Could not find the database driver. \n" + e.getMessage (), "Connection Error",
                            JOptionPane.ERROR_MESSAGE);
                }If I were it should tell me.

  • Using all results in a multiple row resultset returned by a subquery

    I solved the problem of splitting up the dimension fields for each account code as referenced in my first post.  Now I am needing to return the budget amounts of each account code (some account codes return multiple amounts).  I need to do this
    for five sets of years so that I show each year in its own column (a Proposed Budget Year, a Current Budget Year, and three historical budget years).
    Right now I am attempting to use joins to the three tables that show the different types of amounts.  Some account codes will return multiple amount values for the same account code in the same year.  I need all of these amounts in a row associated
    with the account code so that I can group and sum them later on by differing criteria from the dimension fields.  Here is what I have so far (it returns the account codes and dimension fields correctly, but the amounts aren't working and I can't figure
    out how to make them work.
    USE [Financial]
    -- Input variables from web page
    DECLARE @pkYear INT;
    DECLARE @Fund INT;
    DECLARE @Function INT;
    DECLARE @FundingSource INT;
    DECLARE @OperationalUnit INT;
    DECLARE @JobClass INT;
    DECLARE @Version INT;
    DECLARE @Object INT;
    DECLARE @Instorg INT;
    DECLARE @SubMat INT;
    DECLARE @SCC INT;
    DECLARE @ExcludeNoAct INT;
    DECLARE @CurrentUser INT;
    -- Variables to calculate budget years
    DECLARE @PeriodStartDate VARCHAR(256);
    DECLARE @PeriodEndDate VARCHAR(256);
    DECLARE @ProposedBudgetYear INT;
    DECLARE @CurrentBudgetYear INT;
    DECLARE @BudgetYear1 INT;
    DECLARE @BudgetYear2 INT;
    DECLARE @BudgetYear3 INT;
    DECLARE @YearStartDateYear INT;
    DECLARE @ProposedYearStartDateYear INT;
    DECLARE @Year1StartDateYear INT;
    DECLARE @Year2StartDateYear INT;
    DECLARE @Year3StartDateYear INT;
    DECLARE @YearStartDate DATE;
    -- Set variables to test query
    SET @pkYear = 5;
    SET @ExcludeNoAct = 0;
    SET @CurrentUser = 1;
    SET @YearStartDate = (SELECT TOP 1 BeginDate FROM fiYear Y
    Where Y.pkYear = @pkYear);
    PRINT @pkYear;
    PRINT @YearStartDate;
    -- Set variables for budget years
    SET @YearStartDateYear = YEAR(@YearStartDate);
    SET @ProposedYearStartDateYear = @YearStartDateYear + 1;
    SET @Year1StartDateYear = @YearStartDateYear - 1;
    SET @Year2StartDateYear = @YearStartDateYear - 2;
    SET @Year3StartDateYear = @YearStartDateYear - 3;
    PRINT @YearStartDateYear;
    PRINT @ProposedYearStartDateYear;
    PRINT @Year1StartDateYear;
    PRINT @Year2StartDateYear;
    PRINT @Year3StartDateYear;
    -- Set budget years based on year input parameter
    SET @ProposedBudgetYear = (SELECT pkYear
    FROM fiYear
    WHERE YEAR(fiYear.BeginDate) = @ProposedYearStartDateYear)
    SET @CurrentBudgetYear = (SELECT pkYear
    FROM fiYear
    WHERE YEAR(fiYear.BeginDate) = @YearStartDateYear)
    SET @BudgetYear1 = (SELECT pkYear
    FROM fiYear
    WHERE YEAR(fiYear.BeginDate) = @Year1StartDateYear)
    SET @BudgetYear2 = (SELECT pkYear
    FROM fiYear
    WHERE YEAR(fiYear.BeginDate) = @Year2StartDateYear)
    SET @BudgetYear3 = (SELECT pkYear
    FROM fiYear
    WHERE YEAR(fiYear.BeginDate) = @Year3StartDateYear)
    PRINT @ProposedBudgetYear;
    PRINT @CurrentBudgetYear;
    PRINT @BudgetYear1;
    PRINT @BudgetYear2;
    PRINT @BudgetYear3;
    -- Query building exercise
    DECLARE @fkState INT
    DECLARE @fkDimPosFund INT
    DECLARE @fkDimPosFunction INT
    DECLARE @fkDimPosObject INT
    DECLARE @fkDimPosFundingSource INT
    DECLARE @fkDimPosInstructionalOrganization INT
    DECLARE @fkDimPosOperationalUnit INT
    DECLARE @fkDimPosSubjectMatter INT
    DECLARE @fkDimPosJobClass INT
    DECLARE @fkDimPosSpeclCostCntr INT
    SET @fkState = 40
    SET @Version = 11
    --Get the position of the fund account code dimensions determined by state
    SELECT @fkDimPosFund = pkDimensionPosition FROM fiDimensionPosition WHERE Title = 'FUND' AND @fkState = fiDimensionPosition.fkState
    SELECT @fkDimPosFunction = pkDimensionPosition FROM fiDimensionPosition WHERE Title = 'FUNCTION' AND @fkState = fiDimensionPosition.fkState
    SELECT @fkDimPosObject = pkDimensionPosition FROM fiDimensionPosition WHERE Title = 'OBJECT' AND @fkState = fiDimensionPosition.fkState
    SELECT @fkDimPosFundingSource = pkDimensionPosition FROM fiDimensionPosition WHERE Title = 'FUNDING SOURCE' AND @fkState = fiDimensionPosition.fkState
    SELECT @fkDimPosInstructionalOrganization = pkDimensionPosition FROM fiDimensionPosition WHERE Title = 'INSTRUCTIONAL ORGANIZATION' AND @fkState = fiDimensionPosition.fkState
    SELECT @fkDimPosOperationalUnit = pkDimensionPosition FROM fiDimensionPosition WHERE Title = 'OPERATIONAL UNIT' AND @fkState = fiDimensionPosition.fkState
    SELECT @fkDimPosSubjectMatter = pkDimensionPosition FROM fiDimensionPosition WHERE Title = 'SUBJECT MATTER' AND @fkState = fiDimensionPosition.fkState
    SELECT @fkDimPosJobClass = pkDimensionPosition FROM fiDimensionPosition WHERE Title = 'JOB CLASS' AND @fkState = fiDimensionPosition.fkState
    SELECT @fkDimPosSpeclCostCntr = pkDimensionPosition FROM fiDimensionPosition WHERE Title = 'SPECIAL COST CENTER' AND @fkState = fiDimensionPosition.fkState
    PRINT @fkDimPosFund
    PRINT @fkDimPosFunction
    PRINT @fkDimPosObject
    PRINT @fkDimPosFundingSource
    PRINT @fkDimPosInstructionalOrganization
    PRINT @fkDimPosOperationalUnit
    PRINT @fkDimPosSubjectMatter
    PRINT @fkDimPosJobClass
    PRINT @fkDimPosSpeclCostCntr
    SELECT ACCTCODE.fkYear
    ,Y.YearID
    ,ACCTCODE.AccountCode
    ,DIMFUND.Dimension AS [Fund]
    ,DIMFUNCTION.Dimension AS [Function]
    ,DIMOBJECT.Dimension AS [Object]
    ,(SELECT LEFT ( DIMOBJECT.Dimension , 1 )) AS [MAJOR OBJECT]
    ,DIMFUNDINGSOURCE.Dimension AS [Funding Source]
    ,DIMFUNDINGINSTRUCTIONALORG.Dimension AS [Instructional Organization]
    ,DIMOPUNIT.Dimension AS [Operational Unit]
    ,DIMSUBMATTER.Dimension AS [Subject Matter]
    ,DIMJOBCLASS.Dimension AS [Job Classification]
    ,DIMSPECLCOSTCNTR.Dimension AS [Special Cost Center]
    ,BP.Amount AS Proposed
    ,B.Amount AS [Current]
    ,T1.Amount AS [Historical]
    FROM fiAccountCode ACCTCODE
    JOIN fiDimension DIMFUND
    ON DIMFUND.fkDimensionPosition = @fkDimPosFund
    AND (DIMFUND.pkDimension = ACCTCODE.fkDimension1
    OR DIMFUND.pkDimension = ACCTCODE.fkDimension2
    OR DIMFUND.pkDimension = ACCTCODE.fkDimension3
    OR DIMFUND.pkDimension = ACCTCODE.fkDimension4
    OR DIMFUND.pkDimension = ACCTCODE.fkDimension5
    OR DIMFUND.pkDimension = ACCTCODE.fkDimension6
    OR DIMFUND.pkDimension = ACCTCODE.fkDimension7
    OR DIMFUND.pkDimension = ACCTCODE.fkDimension8
    OR DIMFUND.pkDimension = ACCTCODE.fkDimension9
    JOIN fiDimension DIMFUNCTION
    ON DIMFUNCTION.fkDimensionPosition = @fkDimPosFund
    AND (DIMFUNCTION.pkDimension = ACCTCODE.fkDimension1
    OR DIMFUNCTION.pkDimension = ACCTCODE.fkDimension2
    OR DIMFUNCTION.pkDimension = ACCTCODE.fkDimension3
    OR DIMFUNCTION.pkDimension = ACCTCODE.fkDimension4
    OR DIMFUNCTION.pkDimension = ACCTCODE.fkDimension5
    OR DIMFUNCTION.pkDimension = ACCTCODE.fkDimension6
    OR DIMFUNCTION.pkDimension = ACCTCODE.fkDimension7
    OR DIMFUNCTION.pkDimension = ACCTCODE.fkDimension8
    OR DIMFUNCTION.pkDimension = ACCTCODE.fkDimension9
    JOIN fiDimension DIMOBJECT
    ON DIMOBJECT.fkDimensionPosition = @fkDimPosFund
    AND (DIMOBJECT.pkDimension = ACCTCODE.fkDimension1
    OR DIMOBJECT.pkDimension = ACCTCODE.fkDimension2
    OR DIMOBJECT.pkDimension = ACCTCODE.fkDimension3
    OR DIMOBJECT.pkDimension = ACCTCODE.fkDimension4
    OR DIMOBJECT.pkDimension = ACCTCODE.fkDimension5
    OR DIMOBJECT.pkDimension = ACCTCODE.fkDimension6
    OR DIMOBJECT.pkDimension = ACCTCODE.fkDimension7
    OR DIMOBJECT.pkDimension = ACCTCODE.fkDimension8
    OR DIMOBJECT.pkDimension = ACCTCODE.fkDimension9
    JOIN fiDimension DIMFUNDINGSOURCE
    ON DIMFUNDINGSOURCE.fkDimensionPosition = @fkDimPosFund
    AND (DIMFUNDINGSOURCE.pkDimension = ACCTCODE.fkDimension1
    OR DIMFUNDINGSOURCE.pkDimension = ACCTCODE.fkDimension2
    OR DIMFUNDINGSOURCE.pkDimension = ACCTCODE.fkDimension3
    OR DIMFUNDINGSOURCE.pkDimension = ACCTCODE.fkDimension4
    OR DIMFUNDINGSOURCE.pkDimension = ACCTCODE.fkDimension5
    OR DIMFUNDINGSOURCE.pkDimension = ACCTCODE.fkDimension6
    OR DIMFUNDINGSOURCE.pkDimension = ACCTCODE.fkDimension7
    OR DIMFUNDINGSOURCE.pkDimension = ACCTCODE.fkDimension8
    OR DIMFUNDINGSOURCE.pkDimension = ACCTCODE.fkDimension9
    JOIN fiDimension DIMFUNDINGINSTRUCTIONALORG
    ON DIMFUNDINGINSTRUCTIONALORG.fkDimensionPosition = @fkDimPosFund
    AND (DIMFUNDINGINSTRUCTIONALORG.pkDimension = ACCTCODE.fkDimension1
    OR DIMFUNDINGINSTRUCTIONALORG.pkDimension = ACCTCODE.fkDimension2
    OR DIMFUNDINGINSTRUCTIONALORG.pkDimension = ACCTCODE.fkDimension3
    OR DIMFUNDINGINSTRUCTIONALORG.pkDimension = ACCTCODE.fkDimension4
    OR DIMFUNDINGINSTRUCTIONALORG.pkDimension = ACCTCODE.fkDimension5
    OR DIMFUNDINGINSTRUCTIONALORG.pkDimension = ACCTCODE.fkDimension6
    OR DIMFUNDINGINSTRUCTIONALORG.pkDimension = ACCTCODE.fkDimension7
    OR DIMFUNDINGINSTRUCTIONALORG.pkDimension = ACCTCODE.fkDimension8
    OR DIMFUNDINGINSTRUCTIONALORG.pkDimension = ACCTCODE.fkDimension9
    JOIN fiDimension DIMOPUNIT
    ON DIMOPUNIT.fkDimensionPosition = @fkDimPosFund
    AND (DIMOPUNIT.pkDimension = ACCTCODE.fkDimension1
    OR DIMOPUNIT.pkDimension = ACCTCODE.fkDimension2
    OR DIMOPUNIT.pkDimension = ACCTCODE.fkDimension3
    OR DIMOPUNIT.pkDimension = ACCTCODE.fkDimension4
    OR DIMOPUNIT.pkDimension = ACCTCODE.fkDimension5
    OR DIMOPUNIT.pkDimension = ACCTCODE.fkDimension6
    OR DIMOPUNIT.pkDimension = ACCTCODE.fkDimension7
    OR DIMOPUNIT.pkDimension = ACCTCODE.fkDimension8
    OR DIMOPUNIT.pkDimension = ACCTCODE.fkDimension9
    JOIN fiDimension DIMSUBMATTER
    ON DIMSUBMATTER.fkDimensionPosition = @fkDimPosFund
    AND (DIMSUBMATTER.pkDimension = ACCTCODE.fkDimension1
    OR DIMSUBMATTER.pkDimension = ACCTCODE.fkDimension2
    OR DIMSUBMATTER.pkDimension = ACCTCODE.fkDimension3
    OR DIMSUBMATTER.pkDimension = ACCTCODE.fkDimension4
    OR DIMSUBMATTER.pkDimension = ACCTCODE.fkDimension5
    OR DIMSUBMATTER.pkDimension = ACCTCODE.fkDimension6
    OR DIMSUBMATTER.pkDimension = ACCTCODE.fkDimension7
    OR DIMSUBMATTER.pkDimension = ACCTCODE.fkDimension8
    OR DIMSUBMATTER.pkDimension = ACCTCODE.fkDimension9
    JOIN fiDimension DIMJOBCLASS
    ON DIMJOBCLASS.fkDimensionPosition = @fkDimPosFund
    AND (DIMJOBCLASS.pkDimension = ACCTCODE.fkDimension1
    OR DIMJOBCLASS.pkDimension = ACCTCODE.fkDimension2
    OR DIMJOBCLASS.pkDimension = ACCTCODE.fkDimension3
    OR DIMJOBCLASS.pkDimension = ACCTCODE.fkDimension4
    OR DIMJOBCLASS.pkDimension = ACCTCODE.fkDimension5
    OR DIMJOBCLASS.pkDimension = ACCTCODE.fkDimension6
    OR DIMJOBCLASS.pkDimension = ACCTCODE.fkDimension7
    OR DIMJOBCLASS.pkDimension = ACCTCODE.fkDimension8
    OR DIMJOBCLASS.pkDimension = ACCTCODE.fkDimension9
    JOIN fiDimension DIMSPECLCOSTCNTR
    ON DIMJOBCLASS.fkDimensionPosition = @fkDimPosFund
    AND (DIMJOBCLASS.pkDimension = ACCTCODE.fkDimension1
    OR DIMSPECLCOSTCNTR.pkDimension = ACCTCODE.fkDimension2
    OR DIMSPECLCOSTCNTR.pkDimension = ACCTCODE.fkDimension3
    OR DIMSPECLCOSTCNTR.pkDimension = ACCTCODE.fkDimension4
    OR DIMSPECLCOSTCNTR.pkDimension = ACCTCODE.fkDimension5
    OR DIMSPECLCOSTCNTR.pkDimension = ACCTCODE.fkDimension6
    OR DIMSPECLCOSTCNTR.pkDimension = ACCTCODE.fkDimension7
    OR DIMSPECLCOSTCNTR.pkDimension = ACCTCODE.fkDimension8
    OR DIMSPECLCOSTCNTR.pkDimension = ACCTCODE.fkDimension9
    JOIN faBudgetPrep BP ON ACCTCODE.pkAccountCode = BP.fkAccountCode
    JOIN fiBudget B ON B.fkAccountCode = ACCTCODE.pkAccountCode
    JOIN faTransaction T1 ON T1.fkAccountCode = ACCTCODE.pkAccountCode
    JOIN fiYear Y ON Y.pkYear = ACCTCODE.fkYear
    ORDER BY Y.YearID
    If I run the query without the amounts included, I get all the account codes and dimension fields fine.  If I try to include the amounts I get an empty result set.  I tried using a subquery to get the amounts, but it erred out due to returning multiple
    results for each account code on a given amount type in a given year.  I'm stuck.  Please help.
    RandyHJ1957

    The amounts are coming from three other tables that are not yet included in the existing query.  Depending on the year being referenced, the amounts come from the following tables:
    ProposedBudget amounts come from the BudgetPrep table (BudgetPrep.Amount).
    CurrentBudget amounts come from the Budget table (Budget.Amount)
    Each of the the historical years of budget amounts come from the Transactions table, which I call three times with different table aliases (T1, T2, T3) so that I use the following columns T1.Amount, T2.Amount, and T3.Amount for each respective historical
    year.
    For example, I want my years to appear as columns in the result set:
    ProposedBudget     Current Budget     Historical 1     Historical 2     Historical 3
    2015                       2014                    2013              2012            
      2011
    I need to join the amounts to the account codes for each year I am dealing with.
    Sometimes there are several results for the amount per account code in a year (representing different fund divisions) and I need to display all the amounts so I can group and sum them later in a report.  I'm trying to gather all the amounts for each
    account code (and its respective line items) for each of the five years so I can present the data in a report.
    RandyHJ1957

  • Resultset return takes long time

    I have a query which will generate about 1500 rows back, when I try to process the record I find out that it takes about 1seconds to get the first 10 rows back, then 2 minutes to get the next 100 rows back, to get all the rows back, it took about more than 10 minutes. I set the resultset.setFetchsize(100);
    Is there any one has this problem before? Any idea how could I speed it up?
    thanks
    Kelly

    If I run the query directly from SQL plus, it just
    takes about 40-50 seconds, why it is taking so long
    when using resultset?Because your code is processing the resultset and doing so in an inefficient way. You're almost certainly adding your results to a data structure which becomes less and less efficient as you add items to it.
    Show us the code please.
    Dave.

Maybe you are looking for

  • Is it possible to duplicate an item in the project panel with scripts?

    Hey  all, I'm trying to make a script that will duplicate an item in the project panel. I know you can duplicate an item in a comp, but I'd like to duplicate a project Item...app.project.item(2).duplicate(); Something like that, is it possible with s

  • Show "No Applicable Data Found" for Report 0SD_C01_Q22

    Hi Gurus, I just activated BI Content Report, 0SD_C01_Q22 and it's relevant InfoSource,  DataSource and so on. The data from R3 were loaded into the infoCube successfully. However, it shows "No Applicable Data Found" when I executed the query. I have

  • R/3 Source System Check in BW

    Hi , We had a BW client Copy from Production to QA and DEV system. Last week, When I am trying to restore source system connection to R/3 after client copy by creating PORT and PARTNERPROFILES in BW system. I could restore connection in BW Dev but no

  • After IOS5 updating, I can't use my projector

    I have a IPad2. Yesterday, I updated for IOS5. During rebooting, I connected HDMI Adaptor. Suddenly, "This accessory not supported by Ipad" message appeared. Now, My Project(Optoma EX762) is displaying smaller image. Before the update, it was perfect

  • Schema wise backup using rman

    Hi all, Is it possible to take backup of a schema using rman.Or any other backup except export. Thanks in advance.