Incorrect/duplicate result set

In my context index, each document_id is unique. However, when I do a search on one specific document_id, the exact same document is returned to me twice:
select document_id from books
where contains(user_dummy, '402039968');
document_id
402039968
402039968
When I look at the respective partition $I table for this token, I see that:
select token_text, token_type, token_first, token_last, token_count from DR#BOOK_NDX0103$I
where token_text = '402039968';
token_text = 402039968
token_type = 0
token_first = 32035
token_last = 313648
token_count = 2
This double result return does not occur for all documents. Most documents act as expected, and return only once. A correctly working document:
select document_id from books
where contains(user_dummy, '402034806');
document_id
402034806
select token_text, token_type, token_first, token_last, token_count from DR#BOOK_NDX0103$I
where token_text = '402034806';
token_text = 40203480
token_type = 0
token_first = 250153
token_last = 250153
token_count = 1
I do notice a difference in the $I token_count, however do not know what is causing certain documents to be returned twice.
I have also verified that there is a 1:1 relationship in the $K table for this rowid. Does this indicate something was indexed incorrectly? I have run the optimization on this partition. Any ideas/leads would be appreciated!

(if relevant to this situation, Oracle support has not provided a known bug number to me yet)
In DR#BOOK_NDX0103$I, I notice 2 things that do not look correct:
token_text = 402039968
token_type = 0
token_first = 32035
token_last = 313648
token_count = 2
token_first = 32035, however, when I run:
select * from DR#BOOK_NDX0103$K where docid =32035
I get 0 results back, which means that there is no corresponding row in the base table for this docid.
Furthermore, as I indicated before, the token_count, which indicates 2 is incorrect, as there should only be 1 document in this row.
Anybody see this before?

Similar Messages

  • Incorrect result set with using isnull() function  in IQ 16

    Hi team,
    We have IQ 16 on HP UX.
    When we use isnull() function in where clause we get incorrect result set if we do not use column name in the result set.
    In first select we get result with one row but in second one we get an empty result set.
    select ID, dat_start, dat_end, dat_stop
    from table_test
    where ID=1105935925
    and isnull(dat_stop,dat_start) <> dat_end
    select ID
    from table_test
    where ID=1105935925
    and isnull(dat_stop,dat_start) <> dat_end
    It depends on number of row or volume of data in table, It is possible to use option Revert_To_V15_Optimizer to get the correct result.
    Do you have any different idea how to solve it?
    Thanks Milos.

    We have tested two versions:
    Sybase IQ/16.0.0.653/131122/P/sp03/ITANIUM/HP-UXi 11.31/64bit/2013-11-22 01:49:18
    SAP IQ/16.0.0.807/140507/P/sp08/ITANIUM/HP-UXi 11.31/64bit/2014-05-07 21:11:45
    Both versions have given same mistake.
    We have not opened any support case for this issue because it is data depended issue. It is not easy to simulate it as an example.
    Do you think we should open a support case for it?
    Miloš

  • Removing Duplicate records from this result set

    Here is a challenge question that I was playing with one my free time during work.
    I assume that you have the HR sample database somewhere around (hopefully not in production).
    Let us say that you want to get employees from the employees table whose last name is similar to some other employee last name.
    The easiest way is to join the two tables with a join condition that checks for the last name and the employee id. Here is what I came up with.
    select e1.last_name a , e1.first_name b, e2.last_name c, e2.first_name d
    from employees e1 join employees e2
    on ( e1.last_name = e2.last_name and e1.employee_id <> e2.employee_id)
    order by a;
    The above query returns 10 rows. The first and second are essentially the same. The same applies of 3&4, 5&6, 7&8, and 9&10. The question is: is there any way that allow me to get rid of the duplicate rows using sql only from the result set of this query. I sat on it for 15 minutes and I could not figure it out. I will try looking at again after my work is over.

    Example:
    SQL> column a format a10
    SQL> column b format a10
    SQL> column c format a10
    SQL> column d format a10
    SQL>
    SQL>
    SQL> select e1.last_name a , e1.first_name b, e2.last_name c, e2.first_name d
      2  from employees e1 join employees e2
      3  on ( e1.last_name = e2.last_name and e1.employee_id != e2.employee_id)
      4  where e1.employee_id < e2.employee_id
      5  order by a;
    A          B          C          D
    Cambrault  Gerald     Cambrault  Nanette
    Grant      Kimberely  Grant      Douglas
    King       Steven     King       Janette
    Smith      Lindsey    Smith      William
    Taylor     Jonathon   Taylor     Winston
    SQL>

  • Reg: Removing duplicates in MDM result set Iview.

    Hi All,
    I am using a standard result set iview. Is it possible to remove the duplicates in this iview?
    For eg: If i am displaying names in the result set iview, if the same name comes second time,that should not be considered or displayed on the result set iview.
    Thanks,
    Prasanthi.

    You might get better results asking in a MDM forum....

  • Query result set ordered incorrectly

    Hallo,
    I have this problem.
    I have a table (lisitab) with a list of codes, for example:
    A0001
    A0002
    AD063
    AY064
    In my java class I run a query (select lisi_codi from lisitab order by lisi_codi) and I expect the following order:
    A0001
    A0002
    AD063
    AY064
    but I have this result:
    AD063
    AD064
    A0001
    A0002
    What is strange it's that if I execute the query in SQL*Plus or other tools (PLSQLDeveloper for example) it works fine! When run my JDeveloper application I have the bad ordered result set.
    My DB is Oracle 8.1.7 on Windows2000(SP2). The DB language is set as AMERICAN_AMERICA.WE8DEC.
    The client is set with NLS_LANG AMERICAN_AMERICA.WE8DEC and I'm using Oracle OCI JDBC Drivers 8.1.7 deployed with JDeveloper 3.2.
    I presume there's a bug (a BIG BUG!!!) into JDBC Drivers.
    How can I work without trusting in order by ?
    Could anyone help me?
    Thanks
    G.Grimoldi
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Joaquin Sanchez Jimenez ([email protected]):
    Hi:
    Could you send table description and complete query?. What version of JDBC and database ...
    J.<HR></BLOCKQUOTE>
    The table (lisitab) is very simple:
    lisi_codi varchar2(16) not null (PK)
    lisi_desc varchar2(40)
    The select is:
    select lisi_codi from lisitab order by lisi_codi
    I'm working on Oracle 8.1.7 on Windows 2000 and JDBC drivers are Oracle JDBC 8.1.7 deployed with Jdeveloper 3.2.
    I also tried with an Oracle 8.1.7 DB with charset WE8ISO8859P1 and a client with the same charset, but the result is same: bad ordered result set!
    Is there anybody at Oracle who could tell me why and how to resolve (or workaround) this tedious and dangerous problem?
    Thanks
    null

  • SQLException after end of result set

    hi guys.
    im in a lot of bother at the moment.
    i have a GUI with a database in mysql. my gui is a recommender system and so users need to log in etc...
    i know for certain that the gui does connect to the database because when a new user enters there details it does get updated in the database.
    my problem is that when the user tries to gain acces to the system by going to the 'current user' and entering there details nothing happens.
    i am finding it very difficult to find out what the problem is, i have been trying for over a week but no luck and im hoping somebody will know how to help me.
    please could somebody help me here, i have a very short time aswell. monday.
    here is my code below.
    thank-you very much for your help
    its not normal to post the whole class here but im really really stumped.
    the errors that appears in the dos window is SQLException After end of result set.
    *     Function: This class is used for loggin in. It looks for the user name and password           *
    *          the user enters in the database. If there is no match an error message will appear     *
    *          to the user. If there is a match the system logs the user in and dispalys the chose      *
    *          topic page                                   *
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import com.mysql.jdbc.Driver;
    import java.sql.*;
    import java.awt.BorderLayout;
    import java.io.IOException;
    public class CurrentUserFrame extends JPanel implements ActionListener {
         // private is used so object variables cannot be changes by another class.
         private JButton loginButton = null ;
         private JTextField userName = null ;
         private JTextField password = null ;
         private JLabel userLabel = null ;
         private JLabel passwordLabel = null ;
         Boolean loginSuccess ;
         private JPanel cardPanel = null ;
         public CardLayout cardLayout = null ;
         protected static com.mysql.jdbc.Driver mysqlDriver = null;
         String passwordDbase ;
         String usernameDbase ;
              private CardLayout getCardLayout () {
              if (cardLayout == null ) {
              cardLayout = new CardLayout () ;
              return cardLayout ;
         private JPanel getCardPanel () {
         if (cardPanel == null) {
         cardPanel = new JPanel () ;
         return cardPanel ;
         // creates the background colours for the panels by specifying the amounts of red
         // green, blue where 0.5F is the least amount and 1.0F is the most
         Color currentTitleColor = new Color (0.58F, 0.73F, 0.83F) ;
         Color currentMainPanelColor = new Color (0.980F, 0.973F, 0.843F) ;
         public CurrentUserFrame ()
              setLayout (new BorderLayout ()) ;
              JPanel mainCPnl = new JPanel () ;
              mainCPnl.setLayout (new BorderLayout ()) ;
              JPanel mainPanel = new JPanel () ;
              // maindisplaypanel will be set with a borderlayout
              mainPanel.setLayout (new BorderLayout ());
              JPanel descriptionPanel = new JPanel ();
              descriptionPanel.setLayout(new BorderLayout ());
              // creates a textarea for the title and description
              JTextArea description2 = new JTextArea ("\t\tCurrent User Page\n\n" +
              "Please enter your user name and password to login.\n\n" +
              "If you have forgotten your user name or password click on " +
              " 'FORGOT PASSWORD'.") ;
              // stops the text area being edited by the user
              description2.setEditable (false) ;
              // once the text in description reaches the end of the textarea it will start a new line
              description2.setLineWrap (true) ;
              //sets the background colour of the textarea
              description2.setBackground (currentTitleColor) ;
              //sets the type of font with its size for the description textarea
              description2.setFont (new Font ("TimesRoman", Font.BOLD, 16)) ;
              // the descriptionpanel will be placed in the mainpanel at the top.
              mainPanel.add (descriptionPanel, BorderLayout.NORTH) ;
              descriptionPanel.add(description2, BorderLayout. NORTH) ;
              JPanel currentUserPanel = new JPanel () ;
              currentUserPanel.setLayout (new BoxLayout (currentUserPanel, BoxLayout.Y_AXIS)) ;
              // creates a button with an actionlistener so t can carryout a task when it is pressed.
              // the settooltiptext () method displays a message when the user hovers over the button with the curser
              loginButton = new JButton ("Log In") ;
              loginButton.addActionListener(this) ;
              loginButton.setToolTipText ("Logs you into the system") ;
              // creates a text field which is 25 characters in length for the user to enter their name
              userName = new JTextField (25) ;
              // creates a text field which is 15 characters in length for the user to enter their password
              password = new JPasswordField (15) ;
              userLabel = new JLabel ("User Name") ;
              passwordLabel = new JLabel ("Password") ;
              //adds the text fields and the JLabels to the currentuserPanel
              currentUserPanel.add (userLabel) ;
              currentUserPanel.add (userName) ;
              currentUserPanel.add (passwordLabel) ;
              currentUserPanel.add (password) ;
              currentUserPanel.add (loginButton) ;
              JPanel loginPanel = new JPanel () ;
              loginPanel.setLayout (new FlowLayout (FlowLayout.CENTER, 0, 170)) ;
              loginPanel.setBackground (currentMainPanelColor) ;
              loginPanel.add (currentUserPanel, BorderLayout.CENTER) ;
              mainPanel.add (loginPanel, BorderLayout.CENTER) ;
              JPanel chooseTopicCard = new JPanel () ;
              chooseTopicCard.setLayout (new GridLayout (0, 1, 0, 10)) ;
              ChooseTopic frame8 = new ChooseTopic () ;
              frame8.setVisible (true) ;
              chooseTopicCard.add(frame8) ;
              // this will create the panel for the maincontent area and sets the layout
              JPanel cp = getCardPanel();
              cp.setLayout(getCardLayout());
              cp.add("card3",mainPanel) ;
              cp.add("card7", chooseTopicCard) ;
              cardLayout.show (getCardPanel () , "card3") ;
              // this adds the cardlayout to the main panel and then adds the mainpanel screen
              mainCPnl.add(cp) ;
              this.add (mainCPnl) ;
         public void actionPerformed (ActionEvent event) {
              Object source = event.getSource () ;
              if (source == loginButton) {
                   // creates a string to connect to the local host and database
                   // the following 10 lines of code is from the mysql website
                   String url = "jdbc:mysql://:3306/project" ;
                   Connection con = null ;
                   // com.mysql.jdbc.Driver is a folder downloaded from mysql website
                   try {
                        mysqlDriver = (com.mysql.jdbc.Driver) Class.forName ("com.mysql.jdbc.Driver").newInstance () ;
                   } catch ( Exception E) {
                   throw new RuntimeException ("Can not load driver class com.mysql.jdbc.Driver") ;
                   try {
                   // attempts a connection with the computer     
                   // root is used as a default so i can have full access to the database
                   con = DriverManager.getConnection (url,"root","") ;
                   // trys to log in to the database
                   // statement is a mysql class
                   Statement select = con.createStatement ();
                   ResultSet result = select.executeQuery ("select * from user_login") ;                    
                   String userNameText = userName.getText();
                   String passwordText = password.getText();
                   if (userNameText.equals("") || passwordText.equals("")) {
                        JOptionPane okoptionpane = new JOptionPane () ;
                        okoptionpane.showMessageDialog(null, "You have entered your username or password incorrectly, please try again") ;
                        while ((result.next()) && (result != null))
                             //String usernameval ;
                             //String passwordval ;
                             passwordDbase = result.getString("password");
                             usernameDbase = result.getString("user_name");
                             //passwordDbase = "password";
                             //usernameDbase = "user_name";
                             if ((passwordDbase.equals(passwordText)) && (usernameDbase.equals(userNameText))) {
                             cardLayout.show(getCardPanel(), "Card7");                         
                        catch (Exception e) {
                        e.printStackTrace() ;
                        finally {
                        if (con != null ) {               
                             try {con.close () ;  }
                             catch (Exception e) {
                             e.printStackTrace () ;
    LIZ

    ooppps, very sorry, you can guess im new to this forum. sorry again. i thought maybe the whole code was needed.
    i have posted all the output from the dos window.
    java.sql.SQLException: After end of result set
    at com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:3628)
    at com.mysql.jdbc.ResultSet.getString(ResultSet.java:1763)
    at com.mysql.jdbc.ResultSet.getString(ResultSet.java:1827)
    " at CurrentUserFrame.actionPerformed(CurrentUserFrame.java:214) "
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknow
    n Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
    ce)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    i think it is mainly line that is in speach marks. line 214.
    the error that comes up says." after end of result set "
    thank-you
    and sorry once again, im in a bit of a panic,
    Liz

  • Please Help! ?Result Set not updating correctly

    Hi
    This problem has been driving me mad for days now so if anyone can shed any light on it I?d be really grateful.
    I have a jTable in a frame which is populated via a database. (NB I?m using Access 2000 and the JDBC-ODBC driver v.4.00.6019). Data is added to the table via a dialog box. i.e. when the submit button on the dialog box is clicked, the new data input into textfields and text areas in the dialog box is added to the database and then the database is requeried so that the data just added is also displayed in the table. The database is updated every time with no problems, I?m sure of this, however the jTable is not. Sometimes the jTable displays the updated data, other times it doesn?t. e.g. say I input ?a? via the dialog box, this value does not appear in the table. Then I input ?b? say, and ?a? will then be added to the table or sometimes ?a? and ?b? together. Sometimes the table is updated first time no problem, other times I have the scenario mentioned above.
    I?ve looked at the result set that?s being returned when the database is requeried and it contains exactly the same data that appears in the jTable. So despite the fact that the database is definitely updated, I?m getting an incorrect result set. I?m using only the one connection object that?s created when the application is begun. I?ve even tried a dummy select statement before my proper requery of the database (as I?ve seen mentioned for a similar problem) but this doesn?t solve the problem.
    I am ?refreshing? the jTable by way of a refresh method in the jTable?s Table Model.
    The code is:
    public void refresh ()
      rows.clear();
      firstColumn.clear();
      try {
       Statement statement = conn.createStatement();
       ResultSet rs = statement.executeQuery(query);
       ResultSetMetaData rsmd = rs.getMetaData();
       boolean moreRecords = rs.next();
         do
          rows.addElement( getNextRow (rs,rsmd));
         while (rs.next() );
         statement.close();
      catch ( SQLException sqlex )
        sqlex.printStackTrace();
      this.fireTableDataChanged();
    }//End of Method  And the actual refresh method is being called when the dialog box is closed:
    void jButton4_actionPerformed(ActionEvent e) {
        TimetableDialog tdBox = new TimetableDialog (this,"Enter Date and Event",true,dealName);
        setDialogBoxLocationCentre (tdBox);
        tdBox.setVisible(true);//Code below this not executed until Dialog disposed of
        boolean validData = tdBox.returnDataValid();
          timetableModel.refresh();
         Does anyone have any idea what might be going on? It is vital that I solve this. Thanks a lot for any help.
    LGS

    According to the documentation on the Connection class. New Connections are auto-commit by default, but the commit takes place irregularly.
    "The commit occurs when the statement completes or the next execute occurs." This maybe where the ambiguity occurs. Maybe try forcing the commit connection.commit();

  • Result set looping and arrays??????????

    Hey i have a result set problem in using an applet connected to a database.
    After i have accessed a database, i am using a result set to store these values, then put them into arrays to out put to screen. im using:
    count = 0;
    while(rs.next())
    lecturer[count] = rs.getString("FirstName") + " " + rs.getString("Surname");
    room[count] = rs.getString("Room_No");
    sentence = rs.getString("Subjects");
    if(sentence.length()>12)
    space = sentence.indexOf(" ");
    subject[count] = sentence.substring(0,(space));
    subject2[count] = sentence.substring((space+1),sentence.length());
    else
    subject[count] = sentence;
    subject2[count] = " ";
    timeslot[count] = rs.getInt("Time_slot");
    count++;
    resCount++;
    rs.close();
    stm.close();
    The while is there untill there are no more values in the result set. This should work(in theory). But for some reason the while loop goes around and around until 'size' (which is the size for all the arrays) is reached. This is a set value at the start of the applet. But whenever i change it the while loop goes around that many times without fail. this results in duplicate outputs to screen, that i dont want.
    Anyone got any ideas????????????

    This flow doesn't make too much sense to me. Why are you setting an absolute limit on the length of the array, if it should really be determined by the number of rows in your resultset. It sounds like you would be better off using a Collection class, like:
    List names = new ArrayList();
    while(rs.next()) {
      names.add(rs.getString("name"));
    }

  • Grouping result set by a column in a query without aggregate function

    In the below result set, several columns appear for one table.
    col data_Type format a12
    col column_name format a10
    set lines 100
    set pages 50
    SELECT table_name, column_name FROM user_tab_cols WHERE char_used = 'B'
    AND TABLE_name NOT LIKE 'BIN%' ORDER BY TABLE_NAME;
    TABLE_NAME                     COLUMN_NAM
    BONUS                          JOB
    BONUS                          ENAME
    DEPT                           DNAME
    DEPT                           LOC
    EMP                            JOB
    EMP                            ENAME
    EMP_DTL                        ENAME
    EMP_DTL                        LOC
    EMP_DTL                        CONVN_LOC
    MEMBER                         GENDER
    MEMBER                         TEAM
    MEMBER                         MEMBERTYPE
    MEMBER                         FIRSTNAME
    MEMBER                         LASTNAME
    MEMBER                         PHONE
    ORDERS                         STATUS
    SYS_CONFIG                     CODE_ID
    SYS_CONFIG                     FLAG_A
    TOURNAMENT                     TOURTYPE
    TOURNAMENT                     TOURNAMEI don't want the table_name to repeat for every columns within a table_name group. If i use SQLPLUS's BREAK command, it would
    suppress duplicates
    break on table_nameand the resultset would look like
    TABLE_NAME                     COLUMN_NAM
    BONUS                          JOB
                                   ENAME
    DEPT                           DNAME
                                   LOC
    EMP                            JOB
                                   ENAME
    EMP_DTL                        ENAME
                                   LOC
                                   CONVN_LOC
    MEMBER                         GENDER
                                   TEAM
                                   MEMBERTYPE
                                   FIRSTNAME
                                   LASTNAME
                                   PHONE
    ORDERS                         STATUS
    SYS_CONFIG                     CODE_ID
                                   FLAG_A
    TOURNAMENT                     TOURTYPE
                                   TOURNAME
    TYPE                           TYPE
    X                              ENAME
    Y                              ENAMEBut how can i do this using oracle SQL?

    Analytics?
    SQL> with t as
      2  (
      3  select 'A' col1, 100 col2 from dual
      4  union all
      5  select 'A' col1, 200 col2 from dual
      6  union all
      7  select 'B' col1, 800 col2 from dual
      8  union all
      9  select 'B' col1, 400 col2 from dual
    10  union all
    11  select 'C' col1, 500 col2 from dual
    12  )
    13  select decode(row_number() over (partition by col1 order by col2), 1, col1, null) col1
    14         ,col2
    15  from t
    16  /
    C      COL2
    A    100.00
         200.00
    B    400.00
         800.00
    C    500.00
    SQL>Cheers
    Sarma.

  • Stored Procedure in Universe - Multi-result set

    I have been trying to get more information on stored procedures as a source for universes. Business Objects designer 3.1 documentation says the following
    Stored procedures with multi-result set
    Example: A stored procedure that returns more than one result set. At design
    time, several tables are created in the universe structure based on the same
    stored procedure.
    Does this mean?
    1. These result sets are shown as multiple tables in designer?
    2. if so, can these result sets be used as regular tables in designer to build joins and contexts.
    I searched the forum for relevant threads before posting but could not find any. I tried posting this thread earlier - internet connection timed out. Please forgive me if this is a duplicate post.
    Thanks

    DROP TABLE #DescendantsMS SQL Server - right?
    Then don't drop the table.
    From the MS docs for "create table"
    Local temporary tables are visible only in the current session;
    A local temporary table created in a stored procedure is dropped automatically when the stored procedure completes. The table can be referenced by any nested stored procedures executed by the stored procedure that created the table. The table cannot be referenced by the process which called the stored procedure that created the table.

  • Comparing 2 result sets

    Hello
    I have to compare 2 result sets and determine if they are the same.
    The queries are:
    SELECT CARRIER_ID,ROUTE_POSITION
    FROM ROUTE_WG_PHASE4
    SELECT CARRIER_ID,ROUTE_POSITION
    FROM ROUTE_WG_PHASE3
    I tried using minus but it does not work when the first result set has less records than the second.
    Oracle 10g
    Thanks

    I tend to go with Tom's suggestion in the "Comparing the Contents of Two Tables" section of http://www.oracle.com/technology/oramag/oracle/05-jan/o15asktom.html. It has the advantage of showing up missing duplicate rows (eg. where one table has 2 identical rows but the other has only 1).
    In your case, using Tom's method would give you a query of:
    SELECT carrier_id, route_position, COUNT(src1) count1, COUNT(src2) count2
    FROM   (SELECT a.*, 1 src1, TO_NUMBER(NULL) src2
            FROM   route_wg_phase4 a
            UNION ALL
            SELECT b.*, TO_NUMBER(NULL) src1, 2 src2
            FROM   route_wg_phase3 b)
    GROUP BY carrier_id, route_position
    HAVING COUNT(src1) <> COUNT(src2);

  • Saving SQL result set in new table

    Is it possible to save a SQL result set in a new table? (easily)
    What I want to do is duplicate, or back up a table.

    Create table temp as (select a,b,c from your_table); This statement will create a table with your resultset. This will work in Oracle, I am not sure about others.

  • Store result set in to cache

    i want to store some result set(select clause) into cache and reuse into latter part.
    kindly help me out.(oracle 10g)
    Edited by: anutosh on Oct 12, 2009 6:11 AM

    i am inserting value into 2 tables
    'INSERT INTO ' ||
    in_fct_table ||
    ' NOLOGGING SELECT * FROM ' ||
    in_fct_table ||
    '_STG PARTITION(' ||
    f_pop_partition.partition_name ||
    ') LOG ERRORS INTO ' ||
    in_fct_table ||
    '_D(''' ||
    f_pop_partition.partition_name ||
    ''') REJECT LIMIT UNLIMITED';
    duplicates data stored in <_ d> (suffix) table and remaining data(without duplicate) want to store in in_fct_tables(variable name) based on some partition.
    data from in_fct_tables(variable name) table want to populate into some other table . so for that we need to capture the data from in_fct_table.

  • JdbcodbcDriver uses the wrong charSet for interpreting the result set data

    Hi everyone,
    I?m having trouble getting results from a MS Access database which uses Greek characters. All the characters in the range 0-127 are returned good but I get ??? for all above 127.
    Here is some more details:
    OS: win2k
    Local setting for current user: Greek (not that it makes a difference)
    Default Language setting for the System: English (Astralia). This uses charSet Cp1252 or ISO 8859-1 encoding.
    Environment: JBuilder 7.0
    JDK: 1.4.1
    DB: MS Access
    DB charSet: Cp1253 (Greek encoding or ISO 8859-7)
    Connection method:
         java.util.Properties prop = new java.util.Properties();
         prop.put("user" , userName);
         prop.put("password" , password);
         //driver is "sun.jdbc.odbc.JdbcOdbcDriver";     
         //none of these work
         //prop.put("charSet", "UTF-8");
         //prop.put("charSet", "Greek");
         prop.put("charSet", "Cp1253");
         connection = DriverManager.getConnection(MY_ACCESS_DB,prop);
    DataSet Access method:
         // run query and get resultSet rs here
         char[] cBuff= new char[1000];
         // I have tried getString(), getBytes(), getBinaryStream also
         Reader rReader = rs.getCharacterStream(3);
         BufferedReader fIn = new BufferedReader(rReader);
         int res = fIn.read(cBuff, 0, 999);
         // contents of cBuff is incorrect here
    I have also used -Dfile.encoding=Cp1253 in command line which seems to change the default charSet of the JVM. Tested
         String en = new InputStreamReader(System.in).getEncoding();
         System.out.println("Default encoding: " + en);
    By enabling trace and looking at the content of the resultSet object it shows that
    rs.OdbcApi.charSet = "Cp1253"
    So I'm absolutely stumped. The only possible problems I can think of is either a bug in the jdbcodbcDriver or in my native ODBC driver. The latter is less likely since I connected to the same datasouce using a different application and get the right result.
    One more thing that may be helpful, if I set up the default charSet under Win2K to "Greek" (that is setting default language setting in Regional Options under Control Panel)
    Everything works fine.
    Is there anyone out there with answer to my problem?
    Thanks in advance.

    Tried your program and it does exactly as I expected. I get a whole lot of '?'s with my OS default language setting on English but it works fine as soon as I set it to Greek. It does not make a difference if I change the "input language" on the language bar (shift+ctrl) to Greek or not. Or if I change the charSet in your program to something else. Which bring up the question what do you use the charSet setting on your program for? If it is for byte conversion, I don't think you need it since the OS default charset is used by ResultSet.GetString and that needs to be set anyway.
    Anyhow your program basically behaves exactly the same way as mine does. I am almost 100% sure that the problem is with the properties used (or not used) when creating the connections. There has got to be a (provider) property like "useUnicode" or "charSet" or something that is passed through jdbcodbc bridge to ODBC to MS Access to force it to return the result set in UTF-8 format. I confirmed this by using Visual C++ data access program that i wrote (which has the same sort of problem). All other MS Office products know about this property that why they work when i imort data from them.
    This means I don't have a jdbc or even a java problem but my problem is MS Access related. So I�m going to post a question on an MS Access user group (if I find one) and see what I get). Thanks for your help with this.
    By the way AOKabc crashed once and froze another time. I think it had more to do with the libraries you are using rather than your code. I have a trace log if you are interested.
    Soheil

  • Test for null result set

    I am trying to do a test for a null result set. Basically if the result set returns a value I want to display a table, otherwise I want to display an error message. The following code does not produce the error message. Either the test for null is incorrect, or for some reason I am not getting a null result set even when I don't enter any text into the following text boxes (this is for a login screen, these text boxes come a login screen):
    <input type="text" name="username">
    <input type="text" name="password">
    This is the code for the action page:
    <HTML>
    <%@page import="java.sql.*"%>
    <%
    //define connection
    Connection con = null;
    String user1 = request.getParameter("username");
    String pass1 = request.getParameter("password");
    String test = "good";
    try{
    //get the class
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    //get the connection
    con = DriverManager.getConnection("jdbc:odbc:errorlog", "admin", "");
    //catch your exceptions!
    catch(Exception e){
         out.println(e.getMessage());
    %>
    <title>Error Application - Logged Errors</title>
    <link href="style/errorstyle.css" rel="stylesheet" type="text/css">
    <BODY>
    <%
    //define resultset and statement
    ResultSet rs=null;
    Statement stmt=null;
    try {
    //Using the current database connection create a statement
    stmt=con.createStatement();
    %>
    <%
    String sql="SELECT* FROM tblUsers" + " WHERE Username = '"+user1+"' AND Password ='"+pass1+"'";
    rs = stmt.executeQuery(sql);
    %>
    <% //Fetch all the records and print in table
    while(rs.next()){
    String user2 = rs.getString("FirstName");
    String pass2 = rs.getString("LastName");
    %>
    <table width="100%" border="0" cellspacing="1" cellpadding="6">
    <tr >
    <td width="67" height="27" bgcolor="#999999"><strong><font size="- 1">First Name</font></strong>
    </td>
    <td width="89" bgcolor="#999999"><strong><font size="-1">Last
    Name</font></strong>
    </td>
    </tr>
    <tr>
    <td>
    <%out.println(user2);%>
    </td>
    <td><%out.println(pass2);%></td>
    </table>
    <%}
    if (rs == null)
    out.println("Incorrect Username or Password");
    //close all your open resultsets, statements, and connection when you are done with them!
    rs.close();
    stmt.close();
    con.close();
    //catch all your exceptions
    catch (SQLException e) {
         out.println(e.getMessage());
    %>

    You simply test the rs.next().
    if ( rs.next() )
    //spit out the rs row and
    //continue processing the resultset 'til empty
    else
    msg = "invalid username or password
    }

Maybe you are looking for

  • My ipod touch (2nd Gen) doesn't come up in itunes. how do i fix this?

    i have tried reinstalling itunes and it didnt work. i have also looke in device manager and the ipods drive had a yellow triangle on it. this started after i updated itunes.

  • FCP 6 : LOST MANUAL. Where can i find it?

    Hi all. I incredibly LOST my original FCP 6 user's manual vol 3 about audio and effects. I'm desperate because now i have the box incomplete. Where can i buy it? and in the meantime where can i download the pdf version? thanx

  • This is just laughable

    I've been using iphone 3G for almost a year now. I've been terribly disappointed in the AT&T service as it doesn't work in the two places where I spend the most time, home and work. Home is worse, being that I live in a major metro area and whenever

  • Adworker using wrong JDBC connect string during upgrade to 12.1.3

    Our env APPS - 12.1.2 - running on SLES 11 DB 11.2.0.3 - running on IMB System z We cloned PROD to a new host (instance was previously on DB host - debsdb01 and app host debsap03) The clone was made to debsdb04 - and app was reconfigured on debsap03

  • Trouble with Media Player

    Ok my media player is really screwy. It's very slow. It takes FOREVER to load anything. And it keeps telling me that I have no room on my BlackBerry when I try to load a picture. I loaded one picture ONTO the BlackBerry from my PC but when I tried to