Returning one result

Ok. So, here is my issue, I am running a query on an oracle 10 database, through pl/sql developer. The result set returns something like this:
ID Code
A 001-012
A 001-021
A 001-032
A 001-043
B 001-023
B 001-054
B 001-003
B 001-002
B 001-007
I would like it to return this
ID Code
A 001-012
B 001-054
The "Code"(ex. 001-043) does not matter, only has to return one for each ID (ex. A), but has to return every unique ID. The problem with it is that there is no one common "Code" for each "ID".
I am sure this makes absolutely no sense...but if it does, and someone out there has any suggestions..would greatly appreciate it :)

Shamrock wrote:
N Gasparotto wrote:
Shamrock wrote:
I would like it to return this
ID Code
A 001-012
B 001-054Why those two rows and not others instead ?
I mean, why not the two following ones ?
A 001-021
B 001-003
Are they getting randomly ?
Nicolas.That's the thing, it doesn't matter which row it picks, as long as it only returns one row for each ID. That's why I am struggling I think
Edited by: Shamrock on Jun 16, 2010 7:10 AMIf it doesn't matter which "code" it returns with the distinct "id", why select the "code" in the first place. You just said, in effect, it is meaningless.
just SELECT DISTINCT ID ....

Similar Messages

  • Database is only returns one result

    I'm trying to count the number of calls & low priorty call from my account table in my databate. There is only one call so far in it. Call = 1 but its priorty is Low so Low should also be 1. I have check my sql in the Database and it return 1 result but in my program Low still = 0.
    Connection conn;
    String theNoCallsSQL = "Select call_no From Call ";
    String thePLowSQL = "Select call_no From Call where priorty = 'Low' ";
    int NoCalls = 0;
    int Low = 0;
    ResultSet rsetNoCall;
    ResultSet rsetLow;
    rsetNoCall = stmt.executeQuery(theNoCallsSQL);
    while(rsetNoCall.next() == true)
    NoCalls ++;
    rsetLow = stmt.executeQuery(thePLowSQL);
    while(rsetLow.next() == true)
    Low ++;
    conn.close();
    ArrayList myStatsList = new ArrayList();
    CallsStats myStats = new CallsStats();
    myStats.setNoCall(NoCalls);
    myStats.setNoLow(Low);
    return myStatsList;

    Haven't you heard about debugging? The simplest forum of debugging to answer your question would be to insert a line like this:System.out.println("Low++ executed");immediately before the line that saysLow++;Or you could use System.out to display the value of Low immediately beforemyStats.setNoLow(Low);The possibilities are endless.

  • Tags only return one result

    I have tagged numerous bookmarks, but when I type the tag in the location (Awesome) bar, only one result is returned. I have disabled all themes and tried disabled most add-ons. Nothing helps.

    If all else fails, you could use the JDBC driver for your
    SELECTS and your
    ODBCJDBC driver for INSERTS/UPDATES. It's a bit of a crap
    approach, but at
    least it'd work.
    Beyond that, I can't be of any help, sorry. Maybe you could
    revert to the
    7.0.1 version of the ODBC driver?
    Adam

  • Jdbc:odbc bridge only returning one result when a count show 148 !

    Hello,
    Am sure i have done something stupid, but i have an issue with jdbc:odbc ....
    It is a simple sceanrio that i have coded umpteen times before ...
    I have the following ....
    1. Connection to DB2 on an IBM i5 (I apologise for not using native drivers from jt400.jar, but i had an ODBC code example and was in a rush - no excuse i know)
    2. Statement object created from connection above
    3. A string with my SQL in it
    4. A result set for the results.
    These are created as follows:
    Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection(ODBCSource, userID, password);
    if (con == null) {
    // error handling not relevant here
    } else {
    Statement s = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    String SQL = "select * from table";                    
    ResultSet rs = s.executeQuery(SQL);
    i then try to loop ....
    while (rs.next() )
    // stuff
    however, i only ever get one result .... if i stick in the check for isLast, the first loop hits this check, i get my little status message, and the loop ends.
    while (rs.next() )
    if (rs.isLast() )
    System.out.println("I am on last record");
    BUT if i run the SQL
    "select count(*) from table" ... i get a count of 148 !!
    I tried setting the FetchSize through setFetchSize(), but made no difference.
    This is running on a JBoss server 4.2.1GA, JDK is "jdk1.6.0_02" .... i have a suspicion that this may be a JBoss specfic issue, as this exact code runs just fine on the Domino platform that it was originally on, if this is the case, i apologise for wasting everyones time .... but would still appreciate any pointers you can give me.
    Cheers

    sorry .... just relaised this is in the wrong forum ... reposted in the Database connectivity forum !!

  • How to return the result set of multiple select statements as one result set?

    Hi All,
    I have multiple select statements in my stored procedure that I want to return as one result set 
    for instance 
    select id from tableA
    union 
    select name from table b 
    but union will not work because the result sets datatypes are not identical so how to go about this ?
    Thanks

    You have to CAST or CONVERT (or implicitly convert) the columns to the same datatype.  You must find a datatype that both columns can be converted to without error.  In your example I'm guessing id is an int and name is a varchar or nvarchar. 
    Since you didn't convert the datatypes, SQL will use its data precedence rules and attempt to convert name to an int.  If any row contains a row that has a value in name that cannot be converted to an int, you will get an error.  The solution is
    to force SQL to convert the int to varchar.  So you want something like
    select cast(id as varchar(12)) from tableA
    union
    select name from tableb
    If the datatypes are something other that int or varchar, you must find a compatable datatype and then convert one (or both) of the columns to that datatype.
    Tom

  • One question of the method have two chance to return the result.

    Hello All,
    I get a problem at present.The code is following.
    package com.ricky.test;
    public class Test {
         public static void main(String args[]) {
              System.out.println(kkk());
         public static int kkk() {
              int k = 0;
              try {
                   k += 2;
                   return k;
              } catch (Exception e) {
                   k++;
                   return k;
              } finally {
                   k += 5;
                   System.out.println("get Here");
                   return k;
    }why does the result is 7.Isn't it return at the "try" part? and my eclipse alarm that "finally block doesn't complete normally";
    thank you for your help!(I hope someone know my mean,because i'm not good at english. )

    if I change the method to :
    public static int kkk() {
              int k = 0;
              try {
                   k += 2;
                   return k;
              } catch (Exception e) {
                   k++;
                   return k;
              } finally {
                   k += 5;
         }the result is 2(just execute k += 2 and then return the result.)
    but if i change the method to
    public static StringBuffer kkk1() {
              StringBuffer result = new StringBuffer("1");
              try {
                   result = result.append("2");
                   return result;
              } catch (Exception e) {
                   result = result.append("3");
                   return result;
              } finally {
                   result = result.append("4");
                   // return result;
         }the result is 124(the finally block effect the result value)Why?
    Maybe is the result is the memory address.is that right?

  • Oracle:JDBC Call returns no results, SQL*Plus returns 1 record, Please help

    Any help would be greatly appreciated.
    Running 9.2.0.5.0, and using latest 9.2 JDBC 1.4_g drivers in thin mode.
    Execute the following query from SQL*Plus and it returns one row, from JDBC using a PreparedStatement, I get no results. Here's the query, table def, record, etc.:
    Query:
    SELECT
    ID_WEB_FRM,ID_WEB_SIT,CDE_LVL_1_FUNC,
    CDE_LVL_2_FUNC,NUM_WEB_FUNC_PG,NUM_WEB_PG_ID
    FROM
    WEB_FRM
    WHERE
    ID_WEB_FRM = ' '
    OR
    (ID_WEB_SIT = 'test' AND CDE_LVL_1_FUNC = ' '
    AND CDE_LVL_2_FUNC = 'u2T' AND NUM_WEB_FUNC_PG = 1
    AND NUM_WEB_PG_ID = 0)
    Record returned from SQL*Plus:
    ID_WEB_FRM ID_WEB_SIT CDE CDE NUM_WEB_FUNC_PG NUM_WEB_PG_ID
    NfRRmc5XZu test u2T 1 0
    Both in the data returned and the query, there are no blanks, but they are a single space instead (hard to see in message here).
    Java code:
    int count = 1;
    findDBNameStatement.setString(count++," ");
    findDBNameStatement.setString(count++,form.getSiteID());
    findDBNameStatement.setString(count++," ");
    findDBNameStatement.setString(count++, form.getFunctionID());
    findDBNameStatement.setInt(count++,form.getPageNumber());
    findDBNameStatement.setInt(count++,form.getSectionNumber());
    ResultSet resultSet = findDBNameStatement.executeQuery();
    ResultSetMetaData metaData = resultSet.getMetaData();
    resultSet.next() returns false
    DB table:
    CREATE TABLE web_frm (
    ID_WEB_FRM varchar2(10) NOT NULL,
    ID_WEB_SIT varchar2(20) NOT NULL,
    NAM_WEB_FRM varchar2(40),
    TXT_EMAIL_SUBJ varchar2(50),
    CDE_LVL_1_FUNC char(3),
    CDE_LVL_2_FUNC char(3) NOT NULL,
    NUM_WEB_FUNC_PG int NOT NULL,
    NUM_WEB_PG_ID smallint NOT NULL,
    DTE_WEB_FRM_EFF date NOT NULL,
    DTE_WEB_FRM_TRM date,
    CDE_VLDT_RUL char(3),
    DTE_LAST_EXPRT date,
    TXT_CNFRMN_MSG varchar2(4000),
    IND_UPDT_ALWD char(1) NOT NULL,
    TXT_RECAP_HDR varchar2(4000),
    TXT_RECAP_FTR varchar2(4000),
    CDE_WEB_OBJ char(3),
    NUM_MAX_FRM_WIDTH number(4,0),
    IND_RECAP_PG char(1) NOT NULL,
    IND_CNFRM_PG char(1) NOT NULL,
    IND_DSPL_CNFRM_NUM char(1) NOT NULL,
    CNT_SUBM_MAX int,
    TXT_CHCE_ADD_MSG varchar2(255),
    TXT_CHCE_MOD_MSG varchar2(255),
    TXT_WEB_HDR varchar2(4000),
    TXT_WEB_FTR varchar2(4000),
    TXT_WAIT_LIST_MSG varchar2(255),
    FORMOBJECTHEIGHT int NOT NULL,
    FORMOBJECTWIDTH int NOT NULL
    ALTER TABLE web_frm ADD ( CONSTRAINT PK_web_frm PRIMARY KEY (ID_WEB_FRM));
    ALTER TABLE web_frm ADD ( CONSTRAINT UK_web_frm UNIQUE (ID_WEB_SIT,CDE_LVL_1_FUNC,CDE_LVL_2_FUNC,NUM_WEB_FUNC_PG,NUM_WEB_PG_ID)) ;
    Thanks,
    Matt

    That's not quite right. From the javadocs:
    next
    public boolean next()
    throws SQLException
    Moves the cursor down one row from its current position. A ResultSet cursor is initially positioned before the first row; the first call to the method next makes the first row the current row; the second call makes the second row the current row, and so on.
    If an input stream is open for the current row, a call to the method next will implicitly close it. A ResultSet object's warning chain is cleared when a new row is read.
    Returns:
    true if the new current row is valid; false if there are no more rows
    Throws:
    SQLException - if a database access error occurs

  • JDBC Call returns no results, SQL*Plus returns 1 record, Please help!

    Any help would be greatly appreciated.
    Running 9.2.0.5.0, and using latest 9.2 JDBC 1.4_g drivers in thin mode.
    Execute the following query from SQL*Plus and it returns one row, from JDBC using a PreparedStatement, I get no results. Here's the query, table def, record, etc.:
    Query:
    SELECT
    ID_WEB_FRM,ID_WEB_SIT,CDE_LVL_1_FUNC,
    CDE_LVL_2_FUNC,NUM_WEB_FUNC_PG,NUM_WEB_PG_ID
    FROM
    WEB_FRM
    WHERE
    ID_WEB_FRM = ' '
    OR
    (ID_WEB_SIT = 'test' AND CDE_LVL_1_FUNC = ' '
    AND CDE_LVL_2_FUNC = 'u2T' AND NUM_WEB_FUNC_PG = 1
    AND NUM_WEB_PG_ID = 0)
    Record returned from SQL*Plus:
    ID_WEB_FRM ID_WEB_SIT CDE CDE NUM_WEB_FUNC_PG NUM_WEB_PG_ID
    NfRRmc5XZu test u2T 1 0
    Both in the data returned and the query, there are no blanks, but they are a single space instead (hard to see in message here).
    Java code:
    int count = 1;
    findDBNameStatement.setString(count++," ");
    findDBNameStatement.setString(count++,form.getSiteID());
    findDBNameStatement.setString(count++," ");
    findDBNameStatement.setString(count++, form.getFunctionID());
    findDBNameStatement.setInt(count++,form.getPageNumber());
    findDBNameStatement.setInt(count++,form.getSectionNumber());
    ResultSet resultSet = findDBNameStatement.executeQuery();
    ResultSetMetaData metaData = resultSet.getMetaData();
    resultSet.next() returns false
    DB table:
    CREATE TABLE web_frm (
    ID_WEB_FRM varchar2(10) NOT NULL,
    ID_WEB_SIT varchar2(20) NOT NULL,
    NAM_WEB_FRM varchar2(40),
    TXT_EMAIL_SUBJ varchar2(50),
    CDE_LVL_1_FUNC char(3),
    CDE_LVL_2_FUNC char(3) NOT NULL,
    NUM_WEB_FUNC_PG int NOT NULL,
    NUM_WEB_PG_ID smallint NOT NULL,
    DTE_WEB_FRM_EFF date NOT NULL,
    DTE_WEB_FRM_TRM date,
    CDE_VLDT_RUL char(3),
    DTE_LAST_EXPRT date,
    TXT_CNFRMN_MSG varchar2(4000),
    IND_UPDT_ALWD char(1) NOT NULL,
    TXT_RECAP_HDR varchar2(4000),
    TXT_RECAP_FTR varchar2(4000),
    CDE_WEB_OBJ char(3),
    NUM_MAX_FRM_WIDTH number(4,0),
    IND_RECAP_PG char(1) NOT NULL,
    IND_CNFRM_PG char(1) NOT NULL,
    IND_DSPL_CNFRM_NUM char(1) NOT NULL,
    CNT_SUBM_MAX int,
    TXT_CHCE_ADD_MSG varchar2(255),
    TXT_CHCE_MOD_MSG varchar2(255),
    TXT_WEB_HDR varchar2(4000),
    TXT_WEB_FTR varchar2(4000),
    TXT_WAIT_LIST_MSG varchar2(255),
    FORMOBJECTHEIGHT int NOT NULL,
    FORMOBJECTWIDTH int NOT NULL
    ALTER TABLE web_frm ADD ( CONSTRAINT PK_web_frm PRIMARY KEY (ID_WEB_FRM));
    ALTER TABLE web_frm ADD ( CONSTRAINT UK_web_frm UNIQUE (ID_WEB_SIT,CDE_LVL_1_FUNC,CDE_LVL_2_FUNC,NUM_WEB_FUNC_PG,NUM_WEB_PG_ID)) ;
    Thanks,
    Matt

    I have verified the parameters and such, and if I run as a Statement instead of a PreparedStatement, the query works fine. After some more troubleshooting, I narrowed the problem down, but not sure of the fix.
    If I eliminate teh extra parameters and simplify things to:
    SELECT ID_WEB_FRM FROM WEB_FRM WHERE ID_WEB_SIT = 'test' AND CDE_LVL_2_FUNC = 'u2T' AND NUM_WEB_FUNC_PG = 1 AND NUM_WEB_PG_ID = 0
    The code works. But if I add the additional WHERE clause of CDE_LVL_1_FUNC = ' ' (has single space), it returns no data (record in the DB has single space in this new column. Query that does not work:
    SELECT ID_WEB_FRM FROM WEB_FRM WHERE ID_WEB_SIT = 'test' AND CDE_LVL_1_FUNC = ' ' AND CDE_LVL_2_FUNC = 'u2T' AND NUM_WEB_FUNC_PG = 1 AND NUM_WEB_PG_ID = 0
    It appears the JDBC Driver is trimming the parameter when it is a space when set through a PreparedStatement.setString(2," ")

  • SharePoint Foundation 2010 Search returns no results

    Hi,
    SharePoint foundation 2010 Search is not showing any results after configuring the step from the below link.
    http://wiki.sirkit.ca/2011/04/sharepoint-foundation-2010-search-returns-no-results/
    My Server Setup : 
    SharePoint Foundation 2010
    SQL Server 2008 r2
    We have created two web application and configured the search service as above mention link.
    And we have migrated a site from MOSS 2007 to SharePoint 2010 to one of  web application,we assigned search database to the newly migrated content database.
    Previously there was Form based Authentication was done on Moss 2007 site and on SP 2010 we are working on Windows authentication.
    Database showing crawl is working and showing success results as well in SQL table, Its only Not able to show the results on the page.
    Thanks in Advance
    Dinesh
    Regards, Dinesh Reddy.

    Don't look at the databases, it's a bad habit to get into and will lead to confusion.
    In search administration are you getting any sucsess messages in the crawl history and is the number of items in your index non-zero?
    If so that implies that the crawl process is working and it's the user security that's the issue.
    To confirm try searching for a file whilst logged in as the crawl account, that should return results.

  • Building a method with more than one result data

    Hi, everyone:
    I'm a little shy to ask this question, however, it's been hanging in my mind for so long, so I think I'd rather make a confession on it. You may laugh at me if you want, I'm ready for that, but I more look forward to that someone can really give me the light, or even the link, or some hint....
    For your ease of reading, I give the question first, and my whole story behind:
    When I need a method which can provide more than one result( in other words, multiple outputs), how can I do it in Java? As I know, either you pass and object, or the result of the function is an object will do , for the object contains the datas you want, but that means your needs for those data have to be defined in object format in advance, won't that be inconvinient? Or Java has a better solution for that?
    //And here's the whole story....
    I began my career as a programmer by starting with LabVIEW, it's a graphical programming language made by National Instrument, and it's powerful on DAQ, and industrial field. One of the most important issues on design is to devide your system into multiple functions( in its own term: subVI), I think it's just like applying structured analysis method.
    When we dealing with functions in LabVIEW, a programmer can define his own function with mulitiple inputs and outputs, for example, I can design a function called SumAndDevide, which accepts two input ( two variables to be summed and devided) and gives two results( result of summing and that of deviding).
    The methodology has its power, at least it provide the functional decomposition, and you can compose a suitable solution in certain circumstance even they are not the smallest unit function. And testing is easy. It affects me so large that I look the trail of it when I come to other programming languages. In COBOL( well, that is a VERY old COBOL version ), I was scared to find there is no protection to the inner data on the performed sections, while making a outside subroutine to be called is cubersome and really a hard work. When I came to Delphi, I knew that using the result of a function cannot satisfy me, for it give only one output, even you can define it as variant, but I think it's vague to realize. So I use the difference of called by value and called by reference to handle the problem, that is: a value parameter for the input, and a variable paramter for the output.
    Well, when I came to Java, I am stunned again, now there is no passing by reference mechanism in Java, otherwise you have to pass it as an object, but that means when you need multiple outputs, the output has to be defined in object form in advance. And that will be very inconvinient!! I tried to find some solutions, but I can't. So is there any way that in Java you can define a method with multiple output? or Java handles the problem in totally different way?
    Any comments will be appreciated!!
    Thanks!!
    aQunx from Taiwan

    You missed the most common OO solution - separation of concerns and implementation hiding.
    If you have a function which returns a string, that is one method of the object that provides the service.
    If you have a function which returns a real, that is a different method of the object.
    If both functions require common code, move that into a private method which is called by both. If the method is costly, cache the result.
    eg an aerodynamics properties class, which could be done as a multivalued return of (lift, drag), refactored to independent lift() and drag() methods, which delegate to an interpolate() method, which caches the interpolated value and uses mach, pressureHeight and _alpha to determine whether it should recalculate:  /**
       * Calculates the aerodynamic drag force at a given mach, alpha and pressure height.
      public double drag (final double aMach, final double aPressureHeight, final double aAlpha) {
        interpolate(aMach, aPressureHeight, aAlpha);
        return _drag;
       * Calculates the aerodynamic lift force at a given mach, alpha and pressure height.
      public double lift (final double aMach, final double aPressureHeight, final double aAlpha) {
        interpolate(aMach, aPressureHeight, aAlpha);
        return _lift;
      private void interpolate (final double aMach, final double aPressureHeight, final double aAlpha) {
        if (aMach != _mach) {
          setMach(aMach);
          _pressureHeight = Double.NaN;
        if (aPressureHeight != _pressureHeight) {
          setPressureHeight(aPressureHeight);
          _alpha = Double.NaN;
        if (aAlpha != _alpha) {
          setAlpha(aAlpha);
    ... actual interpolation happens in the private setXXX methods.

  • Report obsolete returns diff results when backups are UNAVAIL vs AVAIL

    Hello from Nova Scotia, Canada:
    I'm wondering if someone out there who lives and breaths rman (10gR2) for a living can shed some light...
    We are finding that report obsolete (as well as delete obsolete) are returning different results depending on if our backups
    are AVAILABLE or UNAVAILABLE.
    In our shop, our backups are changed to UNAVAILABLE because they get moved to a different location later, but delete
    obsolete doesn't seem to work as expected unless the backups are AVAILABLE.
    I am pasting some output below to demonstrate my point. Basically, in the output you are about to see, I'm showing you
    my retention policy and I'm listing the backups that I have (and you can see their status is "A" for available). Then I do a
    'report obsolete' command to show you what is considered obsolete (3 files are - which is what I expected). Then I change
    all my backups to unavailable. Then I list all my backups again and show you that their status has changed to "U" for unavailable.
    Then I do 'report obsolete' again and as you can see, I get different results! Can someone explain this to me?? I have RTFManuals
    and no where does it say that availability is a factor that can impact determining what is obsolete. You also see in the output
    below what version we're using (10.2.0.4.0) and that we are using a recovery catalog.
    If someone would like to see additional information, feel free to ask, I'm more than happy to help you help me.
    I should also mention this is a 2 node rac on linux.
    Many Thanks.
    ========================================================
    $ rman target / catalog rrc/rg@RRC
    Recovery Manager: Release 10.2.0.4.0 - Production on Tue May 11 22:06:21 2010
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    connected to target database: IPCSD (DBID=1703825384)
    connected to recovery catalog database
    RMAN> show retention policy;
    RMAN configuration parameters are:
    CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
    RMAN> list backup summary;
    List of Backups
    ===============
    Key     TY LV S Device Type Completion Time     #Pieces #Copies Compressed Tag
    64093   B  F  A DISK        05/10/2010 03:06:52 2       1       NO         HOTBKUP201005100300_DB
    64122   B  A  A DISK        05/10/2010 03:08:41 1       1       NO         HOTBKUP201005100300_ARCHLOGS
    64361   B  F  A DISK        05/10/2010 21:56:33 2       1       NO         HOTBKUP201005102149_DB
    64362   B  F  A DISK        05/10/2010 21:56:37 1       1       NO         HOTBKUP201005102149_DB
    64390   B  A  A DISK        05/10/2010 21:58:02 1       1       NO         HOTBKUP201005102149_ARCHLOGS
    64508   B  F  A DISK        05/11/2010 03:07:01 2       1       NO         HOTBKUP201005110300_DB
    64509   B  F  A DISK        05/11/2010 03:07:10 1       1       NO         HOTBKUP201005110300_DB
    64544   B  A  A DISK        05/11/2010 03:07:47 1       1       NO         HOTBKUP201005110300_ARCHLOGS
    RMAN> report obsolete;
    RMAN retention policy will be applied to the command
    RMAN retention policy is set to recovery window of 1 days
    Report of obsolete backups and copies
    Type                 Key    Completion Time    Filename/Handle
    Backup Set           64093  05/10/2010 03:06:51
      Backup Piece       64097  05/10/2010 03:06:51 /oracle_admin/rman_backups/201005100300/RMAN_HOTBKUP_IPCSD_201005100300_BS_1349_PC_2_CP_1_DB
    Backup Set           64093  05/10/2010 03:04:01
      Backup Piece       64096  05/10/2010 03:04:01 /oracle_admin/rman_backups/201005100300/RMAN_HOTBKUP_IPCSD_201005100300_BS_1349_PC_1_CP_1_DB
    Backup Set           64122  05/10/2010 03:08:41
      Backup Piece       64125  05/10/2010 03:08:41 /oracle_admin/rman_backups/201005100300/RMAN_HOTBKUP_IPCSD_201005100300_BS_1351_PC_1_CP_1_ARCHLOGS
    RMAN> change backup unavailable;
    changed backup piece unavailable
    backup piece handle=/oracle_admin/rman_backups/201005100300/RMAN_HOTBKUP_IPCSD_201005100300_BS_1349_PC_1_CP_1_DB recid=1533 stamp=718599624
    changed backup piece unavailable
    backup piece handle=/oracle_admin/rman_backups/201005100300/RMAN_HOTBKUP_IPCSD_201005100300_BS_1349_PC_2_CP_1_DB recid=1534 stamp=718599846
    changed backup piece unavailable
    backup piece handle=/oracle_admin/rman_backups/201005100300/RMAN_HOTBKUP_IPCSD_201005100300_BS_1351_PC_1_CP_1_ARCHLOGS recid=1536 stamp=718600043
    changed backup piece unavailable
    backup piece handle=/oracle_admin/rman_backups/201005102149/RMAN_HOTBKUP_IPCSD_201005102149_BS_1354_PC_1_CP_1_DB recid=1539 stamp=718667376
    changed backup piece unavailable
    backup piece handle=/oracle_admin/rman_backups/201005102149/RMAN_HOTBKUP_IPCSD_201005102149_BS_1354_PC_2_CP_1_DB recid=1540 stamp=718667600
    changed backup piece unavailable
    backup piece handle=/oracle_admin/rman_backups/201005102149/RMAN_HOTBKUP_IPCSD_201005102149_BS_1355_PC_1_CP_1_DB recid=1541 stamp=718667797
    changed backup piece unavailable
    backup piece handle=/oracle_admin/rman_backups/201005102149/RMAN_HOTBKUP_IPCSD_201005102149_BS_1356_PC_1_CP_1_ARCHLOGS recid=1542 stamp=718667821
    changed backup piece unavailable
    backup piece handle=/oracle_admin/rman_backups/201005110300/RMAN_HOTBKUP_IPCSD_201005110300_BS_1357_PC_1_CP_1_DB recid=1543 stamp=718686020
    changed backup piece unavailable
    backup piece handle=/oracle_admin/rman_backups/201005110300/RMAN_HOTBKUP_IPCSD_201005110300_BS_1357_PC_2_CP_1_DB recid=1544 stamp=718686253
    changed backup piece unavailable
    backup piece handle=/oracle_admin/rman_backups/201005110300/RMAN_HOTBKUP_IPCSD_201005110300_BS_1358_PC_1_CP_1_DB recid=1545 stamp=718686430
    changed backup piece unavailable
    backup piece handle=/oracle_admin/rman_backups/201005110300/RMAN_HOTBKUP_IPCSD_201005110300_BS_1359_PC_1_CP_1_ARCHLOGS recid=1546 stamp=718686452
    Changed 11 objects to UNAVAILABLE status
    RMAN> list backup summary;
    List of Backups
    ===============
    Key     TY LV S Device Type Completion Time     #Pieces #Copies Compressed Tag
    64093   B  F  U DISK        05/10/2010 03:06:52 2       1       NO         HOTBKUP201005100300_DB
    64122   B  A  U DISK        05/10/2010 03:08:41 1       1       NO         HOTBKUP201005100300_ARCHLOGS
    64361   B  F  U DISK        05/10/2010 21:56:33 2       1       NO         HOTBKUP201005102149_DB
    64362   B  F  U DISK        05/10/2010 21:56:37 1       1       NO         HOTBKUP201005102149_DB
    64390   B  A  U DISK        05/10/2010 21:58:02 1       1       NO         HOTBKUP201005102149_ARCHLOGS
    64508   B  F  U DISK        05/11/2010 03:07:01 2       1       NO         HOTBKUP201005110300_DB
    64509   B  F  U DISK        05/11/2010 03:07:10 1       1       NO         HOTBKUP201005110300_DB
    64544   B  A  U DISK        05/11/2010 03:07:47 1       1       NO         HOTBKUP201005110300_ARCHLOGS
    RMAN> report obsolete;
    RMAN retention policy will be applied to the command
    RMAN retention policy is set to recovery window of 1 days
    Report of obsolete backups and copies
    Type                 Key    Completion Time    Filename/Handle
    Backup Set           64362  05/10/2010 21:56:37
      Backup Piece       64366  05/10/2010 21:56:37 /oracle_admin/rman_backups/201005102149/RMAN_HOTBKUP_IPCSD_201005102149_BS_1355_PC_1_CP_1_DB
    RMAN>I just want to point out that the one obsolete file just contains a Control File and a SPFILE, as shown below:
    BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    64362   Full    17.64M     DISK        00:00:02     05/10/2010 21:56:37
            BP Key: 64366   Status: UNAVAILABLE  Compressed: NO  Tag: HOTBKUP201005102149_DB
            Piece Name: /oracle_admin/rman_backups/201005102149/RMAN_HOTBKUP_IPCSD_201005102149_BS_1355_PC_1_CP_1_DB
      Control File Included: Ckp SCN: 15213106404   Ckp time: 05/10/2010 21:56:35
      SPFILE Included: Modification time: 05/09/2010 18:00:42---------------
    **** END *****
    Edited by: user478914 on May 12, 2010 3:03 AM
    Edited by: user478914 on May 12, 2010 3:24 AM

    Thanks for reading my post. Here is the result of doing the crosscheck command.
    Problem still exists. Someone correct me if I'm wrong but I believe crosscheck does
    nothing because all my backups are listed as unavailable, so there is nothing for it to do.
    Any other thoughts or suggestions?
    This problem is driving me bonkers. I have read the Backup and Recovery Basic Guide and Advanced Guide,
    googled the web, searched OTN, searched Metalink and I can't find anything on the topic of backup
    piece availability affecting obsolescence. Many thanks.
    RMAN> list backup summary;
    List of Backups
    ===============
    Key     TY LV S Device Type Completion Time     #Pieces #Copies Compressed Tag
    64361   B  F  U DISK        05/10/2010 21:56:33 2       1       NO         HOTBKUP201005102149_DB
    64362   B  F  U DISK        05/10/2010 21:56:37 1       1       NO         HOTBKUP201005102149_DB
    64390   B  A  U DISK        05/10/2010 21:58:02 1       1       NO         HOTBKUP201005102149_ARCHLOGS
    64508   B  F  U DISK        05/11/2010 03:07:01 2       1       NO         HOTBKUP201005110300_DB
    64509   B  F  U DISK        05/11/2010 03:07:10 1       1       NO         HOTBKUP201005110300_DB
    64544   B  A  U DISK        05/11/2010 03:07:47 1       1       NO         HOTBKUP201005110300_ARCHLOGS
    64761   B  F  U DISK        05/12/2010 03:06:23 2       1       NO         HOTBKUP201005120300_DB
    64762   B  F  U DISK        05/12/2010 03:06:30 1       1       NO         HOTBKUP201005120300_DB
    64792   B  A  U DISK        05/12/2010 03:08:13 1       1       NO         HOTBKUP201005120300_ARCHLOGS
    RMAN> crosscheck backup;
    using channel ORA_DISK_1
    RMAN> report obsolete recovery window of 1 days;
    Report of obsolete backups and copies
    Type                 Key    Completion Time    Filename/Handle
    Backup Set           64362  05/10/2010 21:56:37
      Backup Piece       64366  05/10/2010 21:56:37 /oracle_admin/rman_backups/201005102149/RMAN_HOTBKUP_IPCSD_201005102149_BS_1355_PC_1_CP_1_DB
    Backup Set           64509  05/11/2010 03:07:10
      Backup Piece       64520  05/11/2010 03:07:10 /oracle_admin/rman_backups/201005110300/RMAN_HOTBKUP_IPCSD_201005110300_BS_1358_PC_1_CP_1_DB
    RMAN>

  • "select count(*)" and "select single *" returns different result

    Good day!
    product version SAP ECC 6.0
    oracle10
    data transfers from external oracle db into customer tables using direct oracle db link
    sometimes I get case with different results from 2 statements
    *mytable has 10 rows
    *1st statement
    data: cnt type I value 0.
    select count( * ) into cnt from mytable WHERE myfield_0 = 123 and myfield_1 = '123'.
    *cnt returns 10 - correct
    *2nd statement
    select single * from  mytable WHERE myfield_0 = 123 and myfield_1 = '123'.
    *sy-dbcnt returns 0
    *sy-subrc returns 4 - incorrect, 10 rows are "invisible"
    but
    1. se16 shows correct row number
    2. I update just one row from "invisible" rows using se16 and 2nd statement returns correct result after that
    can not understand why
    thank you in advance.

    Thank you, Vishal
    but,
    general problem is that
    1. both statements have the same WHERE conditions
    2. 1st return resultset with data (sy-dbcnt=10), 2nd return empty dataset, but must return 1 in sy-dbcnt
    Yes, different meaning, you are right, but must 2nd must return 1, because of "select single *" construction, not 0.
    Dataset to process is the same, WHERE conditions are equal...
    I think the problem is that how ABAP interperets select count(*) and "select single *".
    Maybe "select count (*)" scans only PK from index page(s)? and "select single *" scans data pages? and something is wrong with that?
    I'm new in SAP and didn't find any SAP tool to trace dump of data and indexes pages with Native SQL.
    se16 shows all records.
    And why after simple manual update of just one record using se16 "select single *" returns 1?
    I've just marked one row to update, didn't change any data, then pressed "save".

  • Returning Different Results for the  Same Search Value

    I'm creating a word list and I'm using Lookup to find text entries in column D and return values from column A. I can manage one result based on the search criteria however I'm wondering if it's possible to return multiple entries from column A if multiple matches are found in column D:
    As you can see I'm trying to use the formula =LOOKUP("Aggression",D,A) to find all the instances of "Aggression" in column D and return all the corresponding results from column A (audacious, barefaced, and depredation). Lookup however only returns the last match (depredation).

    I wish you'd shown where your LOOKUP function is located and what you're trying to do with it. Are you going to be using these results in another function? Or are you simply wanting to display the results of your search?
    If the latter, there's an elegant way to make this happen. Let's create a single-cell table on the same page, holding the word you're searching for. (Ideally, this could be a drop-down list -- and that can be made to dynamicly hold all the discrete values in column D -- but that's another discussion.) Let's call this table "Search".
    Add a column (which can be hidden) to your original table. Let's insert this next to your column D, making it column E. Cell E2 contains =IF($D2=Search :: $A$1,TRUE,FALSE). Drag/copy that down the column. You'll now have a value of TRUE in this column for all the words you're looking for. Now click on the top of this column E and click "Show More Options".... and click on "Show rows that match the following". Set it to show where Column E is true. You now show only the words in which the "category" matches the search word.
    Change the word in your Search table, and the display of your original table automatically adjusts.
    The nice part is that the entire line is displayed so you can see definitions and contexts as well.
    Vince

  • Same Query returning different result (Different execution plan)

    Hi all,
    To day i have discovered a strange thing: a query that return a different result when using a different execution plan.
    The query :
    SELECT  *
      FROM schema.table@database a
    WHERE     column1 IN ('3')
           AND column2 = '101'
           AND EXISTS
                  (SELECT null
                     FROM schema.table2 c
                    WHERE a.column3 = SUBSTR (c.column1, 2, 12));where schema.table@database is a remote table.
    when executed with the hint /*+ ordered use_nl(a c) */ these query return no result and its execution plan is :
    Rows     Row Source Operation
          0  NESTED LOOPS  (cr=31 r=0 w=0 time=4894659 us)
       4323   SORT UNIQUE (cr=31 r=0 w=0 time=50835 us)
       4336    TABLE ACCESS FULL TABLE2 (cr=31 r=0 w=0 time=7607 us)
          0   REMOTE  (cr=0 r=0 w=0 time=130536 us)When i changed the execution plan with the hint /*+ use_hash(c a) */
    Rows     Row Source Operation
       3702  HASH JOIN SEMI (cr=35 r=0 w=0 time=497839 us)
      22556   REMOTE  (cr=0 r=0 w=0 time=401176 us)
       4336   TABLE ACCESS FULL TABLE2 (cr=35 r=0 w=0 time=7709 us)It seem that when the execution plan have changed the remote query return no result.
    It'is a bug or i have missed somthing ?
    PS: The two table are no subject to insert or update statement.
    Oracle version : 9.2.0.2.0
    System version : HP-UX v1
    Thanks.

    H.Mahmoud wrote:
    Oracle version : 9.2.0.2.0
    System version : HP-UX v1Hard to say. You're using a very old and deprecated version of the database, and one that was known to contain bugs.
    9.2.0.7 was really the lowest version of 9i that was considered to be 'stable', but even so, it's old and lacking in many ways.
    Consider upgrading to the latest database version at your earliest opportunity. (or at least apply patches up to the latest 9i version before querying if there is bugs in your really low buggy version)

  • Returning a result set/record from a dynamic query

    There seems to be plenty of examples for using Native Dynamic Sql to formulate and execute a dynamic query, however there are no examples of returning a result set or records which contain the rows of data that are retrieved by executing the query. Could someone give us an example?

    Welcome to the Oracle forum....
    CREATE OR REPLACE PACKAGE curspkg_join AS
    TYPE t_cursor IS REF CURSOR ;
    Procedure open_join_cursor1 (n_EMPNO IN NUMBER, io_cursor IN OUT t_cursor);
    END curspkg_join;
    Create the following Oracle package body on the Oracle server:
    CREATE OR REPLACE PACKAGE BODY curspkg_join AS
    Procedure open_join_cursor1 (n_EMPNO IN NUMBER, io_cursor IN OUT t_cursor)
    IS
    v_cursor t_cursor;
    BEGIN
    IF n_EMPNO <> 0
    THEN
    OPEN v_cursor FOR
    SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME
    FROM EMP, DEPT
    WHERE EMP.DEPTNO = DEPT.DEPTNO
    AND EMP.EMPNO = n_EMPNO;
    ELSE
    OPEN v_cursor FOR
    SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME
    FROM EMP, DEPT
    WHERE EMP.DEPTNO = DEPT.DEPTNO;
    END IF;
    io_cursor := v_cursor;
    END open_join_cursor1;
    END curspkg_join;
    Dim Oraclecon As New OracleConnection("Password=pwd;" & _
    "User ID=uid;Data Source=MyOracle;")
    Oraclecon.Open()
    Dim myCMD As New OracleCommand()
    myCMD.Connection = Oraclecon
    myCMD.CommandText = "curspkg_join.open_join_cursor1"
    myCMD.CommandType = CommandType.StoredProcedure
    myCMD.Parameters.Add(New OracleParameter("io_cursor", OracleType.Cursor)).Direction = ParameterDirection.Output
    myCMD.Parameters.Add("n_Empno", OracleType.Number, 4).Value = 123
    Dim myReader As OracleDataReader
    Try
    myCMD.ExecuteNonQuery()
    Catch myex As Exception
    MsgBox(myex.Message)
    End Try
    myReader = myCMD.Parameters("io_cursor").Value
    Dim x, count As Integer
    count = 0
    Do While myReader.Read()
    For x = 0 To myReader.FieldCount - 1
    Console.Write(myReader(x) & " ")
    Next
    Console.WriteLine()
    count += 1
    Loop
    MsgBox(count & " Rows Returned.")
    myReader.Close()
    Oraclecon.Close()
    The above code is working in one of our application; which is using ref cursor as result set and get from procedure. I hope you can found more code by google and/or search in this forum as well; if above code is not useful to you.
    HTH
    Girish Sharma

Maybe you are looking for