Query to fetch a set of records

My query is expected to fetch a huge number of records, say 20000, depending on the parameters passed through front end. The front end developer wants that these records should be displayed on different pages with each page displaying 100 records. But the next 100 records should be fetched whenever user selects next page option i.e. the query should execute 20000/100 times. If I use order by and rownum (i think can be used, not tried), again it will require sorting and the operation will be slow which is to be avoided. What should be done in this case? Front end is Java and database is Oracle 9i.

> Will there be any difference in performance in these
2 approaches ?
1) Fetch all records with a single query, store in an
array (in Java) and keep displaying 100 reocrds per
page.
2) Execute query multiple times, query will be using
rownum. If if the query displays a subset of records,
it has to fetch all the records evey time.
One of these questions that results in a YES and NO answer.
Simplistically, yes - significant performance improvement as subsequent page displays do not need to access the Database. The rows are locally cached.
Unfortunately, some J2EE developers only think that far and code it like that on development. And performance is awesome.
They fail to realise that problems with this approach are that
a) it does not scale
b) it lacks data consistency
So it gets implemented. The 1st time 20 users hit that J2EE app server, it trashes memory attempting to create huge caches for each user - with each cache containing the all rows that the user may (or may not) be interested in.
Performance degrades drastically as the swap space is totally trashed. The machine crashes.
Clever J2EE architects respond with "oh, we must scale" - and want to purchase more hardware, configure these as J2EE servers and cluster the application tier. What a silly and expensive way to achieve scalability!
The business user on the other hand sees data in the cache - it can be old. It may not reflect the current consistent data in the database. The business user does not know that. He tells the customer "Yes, we still have a 100 units at the special price.. not a problem, I will reserve all 100 for you, my special customer". And then get mud in his face as he proceeds with an attempt to sell a 100 non-existing units that have long since been sold.
Hmmm.. so the clever J2EE architects come up with the idea of using persistence in the app tier by using something like EJB. Let's cache all the data! And let us share that data between users! Wow!! Great, it now solves that problem!
But it does not. Instead something like EJB is VERY POOR attempt to emulate what the Database does, and does EXTREMELY WELL.
J2EE suffers from Let-Us-Reinvent-The-Database-Wheel-In-The-Application-Tier approach. It is fatally flawed. The Database is much more than just a bit bucket wheel. The Database is much more scalable in design and use than a (Java) app tier.
Despite what the Java prophets proclaim, the J2EE architecture is not The Saviour - and no substitution for common sense and logic.

Similar Messages

  • How does jdbc fetch a set of records in oracle

    Hi,
    Oracle does not support server side cursors,if so how does jdbc fetch a set of records(set by setFetchSize(), which is 10 by default) each time I say rs.next().Does this mean Query is re-executed to fetch the next set of records? Can some body throw some light on this?
    thanx in advance
    Gnayan

    You are asking about implementation details of some JDBC driver, but you don't say which one. This makes it very difficult to answer your question. You might want to try asking the question of the people who wrote the driver.

  • How to fetch 2 set of records in MII from SQL procedure

    Hi Experts,
    I am invoking a SQL procedure from MII which return 2 set of records. But at MII I am able to get only first set of records. Is there any configuration required at MII side or SQL side to get both set of records in MII?
    Here is the SQL Query Structure
    Create procedure Sample_Proc
      @Param1 Varchar(10),
      @Param2 varchar(10),
      @Param3 Varchar(20) OUT,
      SET INCOUNT ON;
    AS
    Begin
      *//Selection statements//*
    END
    SP Executing in MII
    Declare @Param1,
      @Param2,
      @Param3,
    Exec Sample_Proc
      @Param1='name',
      @Param2='Id',
      @Param3=@Param3 OUTPUT,
    Select @Param3
    Our SP is returning values (Say Recordset1)based on the input parameters 1 and 2 , along with Parameter3 value(Say Recordset2) in MS SQL server but in MII its returning only the values(Recordset1) ... how to fetch recordset2 values in MII
    I hope MII can return 2 set of records (rowsets) after executing the procedure.
    MII version -> 12.2.3 Build(182)
    Thanks & Regards,
    Rajasekhar Kantepalli

    Hi Swaroop,
    With MII 14.0 SP5 Patch 11, in a transaction, I get following XML output for a query that executes an SP(returning multiple resultSets) :
    And, results in this format can surely be used for further processing in an MII transaction.
    Thanks Rajasekhar, got to know about this because of your query.
    regards,
    Manisha

  • Query to fetch child of child records of a given party

    Hi,
    We have requirement to fetch the child records(child of child records also) of a given party name.
    We had written the below query:
    SELECT distinct hp.party_name
    FROM hz_parties hp,
    hz_relationships hzr,
    hz_parties hp2
    WHERE hzr.direction_code = 'C'
    AND hp.party_id = hzr.subject_id
    AND hzr.object_id = hp2.party_id
    AND relationship_type ='Parent-Child Hierarchy'
    --'Org Structure'
    --'Parent-Child Hierarchy'
    AND hz_utility_v2pub.get_lookupmeaning
    ('AR_LOOKUPS',
    'PARTY_RELATIONS_TYPE',
    hzr.relationship_code
    ) = 'Child of'
    AND hp2.party_name = :P_CUSTOMER
    This query fetches only one level of parent and child records.
    Please help us in fetching the child of child records also. We tried using 'Connect By', but its not working as expected.
    Thanks in advance.

    Hi,
    We have requirement to fetch the child records(child of child records also) of a given party name.
    We had written the below query:
    SELECT distinct hp.party_name
    FROM hz_parties hp,
    hz_relationships hzr,
    hz_parties hp2
    WHERE hzr.direction_code = 'C'
    AND hp.party_id = hzr.subject_id
    AND hzr.object_id = hp2.party_id
    AND relationship_type ='Parent-Child Hierarchy'
    --'Org Structure'
    --'Parent-Child Hierarchy'
    AND hz_utility_v2pub.get_lookupmeaning
    ('AR_LOOKUPS',
    'PARTY_RELATIONS_TYPE',
    hzr.relationship_code
    ) = 'Child of'
    AND hp2.party_name = :P_CUSTOMER
    This query fetches only one level of parent and child records.
    Please help us in fetching the child of child records also. We tried using 'Connect By', but its not working as expected.
    Thanks in advance.

  • Pass a set of Records form Form to a Report

    Hi,
    Lets say that I've already fetched a set of records on Oracle Form, and I want to pass these reocrds to a Report " on the Report I dont wana use range or where clause to give me these recods"
    Any ideas how to do that please?
    Thanks!

    Passing a (Forms) Record Group as DATA_PARAMETER to Reports:
    First example:
    Forms code (in WHEN-BUTTON-PRESSED trigger) calls reports module
    and sends record group "rg_dept" (populated from :SYSTEM.LAST_QUERY) as parameter:
    DECLARE
    rg_id_l RECORDGROUP;
    rg_name_l VARCHAR2 (30) := 'RG_DEPT';
    status_l NUMBER;
    pl_id_l PARAMLIST;
    pl_name_l VARCHAR2 (30) := 'PARAM_LIST';
    BEGIN
    rg_id_l := FIND_GROUP (rg_name_l);
    IF NOT ID_NULL (rg_id_l) THEN
    DELETE_GROUP (rg_id_l);
    END IF;
    rg_id_l := CREATE_GROUP_FROM_QUERY (rg_name_l, :SYSTEM.LAST_QUERY);
    status_l := POPULATE_GROUP (rg_id_l);
    IF status_l <> 0 THEN
    RAISE FORM_TRIGGER_FAILURE;
    END IF;
    pl_id_l := GET_PARAMETER_LIST (pl_name_l);
    IF NOT ID_NULL (pl_id_l) THEN
    DESTROY_PARAMETER_LIST (pl_id_l);
    END IF;
    pl_id_l := CREATE_PARAMETER_LIST (pl_name_l);
    ADD_PARAMETER (pl_id_l, 'Q_1', DATA_PARAMETER, rg_name_l);
    RUN_PRODUCT (REPORTS, 'rec_group', SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id_l, NULL);
    END;
    Reports module must have query with the same name as parameter in ADD_PARAMETER
    statement (in this code - "Q_1"), and SQL Query Statement in Reports must have
    same number and type of columns as record group, for example:
    SELECT ROWID, 1 deptno, 'x' dname, 'x' loc FROM DUAL
    And - we can't pass a DATA_PARAMETER to a child query in Report Builder.
    Data passing is supported only for master queries.
    Second example:
    Forms transfers to Reports records from "dept" block,
    using non-query record group (populated from Forms "dept" block in a LOOP):
    DECLARE
    rg_id_l RECORDGROUP;
    rg_name_l VARCHAR2 (30) := 'DEPT';
    row_count_l NUMBER;
    rgc_id_l GROUPCOLUMN;
    pl_id_l PARAMLIST;
    pl_name_l VARCHAR2 (30) := 'PARAM_LIST';
    BEGIN
    rg_id_l := FIND_GROUP (rg_name_l);
    IF NOT ID_NULL (rg_id_l) THEN
    DELETE_GROUP (rg_id_l);
    END IF;
    rg_id_l := CREATE_GROUP (rg_name_l);
    rgc_id_l := ADD_GROUP_COLUMN (rg_id_l, 'deptno', NUMBER_COLUMN);
    rgc_id_l := ADD_GROUP_COLUMN (rg_id_l, 'dname', CHAR_COLUMN, 14);
    rgc_id_l := ADD_GROUP_COLUMN (rg_id_l, 'loc', CHAR_COLUMN, 13);
    GO_BLOCK ('dept');
    FIRST_RECORD;
    row_count_l := 0;
    LOOP
    row_count_l := row_count_l + 1;
    ADD_GROUP_ROW (rg_id_l, row_count_l);
    SET_GROUP_NUMBER_CELL (rg_name_l || '.deptno', row_count_l, :dept.deptno);
    SET_GROUP_CHAR_CELL (rg_name_l || '.dname', row_count_l, :dept.dname);
    SET_GROUP_CHAR_CELL (rg_name_l || '.loc', row_count_l, :dept.loc);
    EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
    NEXT_RECORD;
    END LOOP;
    IF row_count_l = 0 THEN
    MESSAGE ('Nothing to print'); PAUSE;
    RETURN;
    END IF;
    pl_id_l := GET_PARAMETER_LIST (pl_name_l);
    IF NOT ID_NULL (pl_id_l) THEN
    DESTROY_PARAMETER_LIST (pl_id_l);
    END IF;
    pl_id_l := CREATE_PARAMETER_LIST (pl_name_l);
    ADD_PARAMETER (pl_id_l, 'Q_1', DATA_PARAMETER, rg_name_l);
    RUN_PRODUCT (REPORTS, 'REC_GROUP_REPORT', SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id_l, NULL);
    END;
    This works in Forms 6i. In Forms 9i we must use RUN_REPORT_OBJECT instead of RUN_PRODUCT
    (see Oracle MetaLink document 110495.1 "Passing a Record Group to Reports Using RUN_REPORT_OBJECT").
    Regards,
    Zlatko Sirotic

  • SQL query to fetch records  from  26 onwards

    Want to know SQL query to fetch records from 26 onwards.

    See the fifth entry on the FAQ page:
    Re: How to attach a java bean in forms6i

  • How to fetch particular segment of records?

    Hi all,
    My last question is how to limit the rows returned. This time my question is how to fetch particular segment of records from DB table?
    In detail, if one table has 95 records, which method can be used to fetch #71-80 record only, not fetch #1-80 first and abandon the preceeding 70 ones?

    There are a few methods:
    - Set firstResult and maxResult on the JPA Query, this is normally the best option. Depending on your database this will best optimized to only select these rows.
    - Use a Cursor, in EclipseLink 1.1 there are QueryHints for doing this, see org.eclipse.persistence.config.QueryHints.
    - Select all of the results, and store them in your app or http session, and scroll through them in memory on next/previous.
    - Select just the ids, and store them in your app/page or http session, each page select the batch of object with the ids.
    - Use an order-by and critieria to limit your results to a specific amount.
    James : http://www.eclipselink.org
    http://en.wikibooks.org/wiki/Java_Persistence

  • How to devide the set of records into groups in SQL itself.

    Hi , i am using 10.2.4.0 of oracle.
    I am having one requirement, in which i have to devide the set of records into certain groups , so that they can be executed partly but not in one run.
    So in the 'SELECT' clause itself i want to asssign particular value (may be 1 )to first 50000 records then another value(may be 2) to next 10000, like wise. And again the total count of records will also varry time to time , if the total count of record set is less than 10000 , then it should only assign '1' to all the records. i will set the group values (1,2,3...) as another column itself.
    Can you please let me know if this can be done in SQL without going for PLSQL?

    Hi,
    That's called a Pagination Query , and here's one way to do it:
    WITH     got_grp          AS
         SELECT     x.*
         ,     CEIL ( ROW_NUMBER () OVER (ORDER BY  x_id) 
                   / 50000
                   )          AS grp
         FROM     table_x  x
    --     WHERE     ...          -- If you need any filtering, put it here
    SELECT     *               -- Or list the columns you want
    FROM     got_grp
    WHERE     grp     = 1
    ;ROW_NUMBER () OVER (ORDER BY x_id)     assigns unique integers 1, 2, 3, ... to all all rows, in the same order as x_id (even if x_id is not unique).
    CEIL (ROW_NUMBER () OVER (ORDER BY x_id) / 50000)     maps the 1st 50,000 of those numbers to 1, the 2nd 50,000 to 2, and so on.
    Analytic functions (like ROW_NUMBER) as computed after the WHERE clause is applied, so, to use the results in a WHERE clause, then you need to compute them in a sub-query. If you just want to display the number, and not use it in a WHERE clause, then you don't need a sub-query.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    In the case of a DML operation (such as UPDATE) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using.
    See the forum FAQ {message:id=9360002}

  • Problem fetch large number of records

    Hi
    I want to fetch large number of record from database.and I use secondary index database for improve performance for example my database has 100000 records and query fetch 10000 number of records from this database .I use secondary database as index and move to secondary database until fetch all of the information that match for my condition.but when I move to this loop performance terrible.
    I know when I use DB_MULTIPLE fetch all of the information and performance improves but
    I read that I can not use this flag when I use secondary database for index.
    please help me and say me the flag or implement that fetch all of the information all to gether and I can manage this data to my language
    thanks alot
    regards
    saeed

    Hi Saeed,
    Could you post here your source code, that is compiled and ready to be executed, so we can take a look at the loop section ?
    You won't be able to do bulk fetch, that is retrieval with DB_MULTIPLE given the fact that the records in the primary are unordered by master (you don't have 40K consecutive records with master='master1'). So the only way to do things in this situation would be to position with a cursor in the secondary, on the first record with the secondary key 'master1' retrieve all the duplicate data (primary keys in the primary db) one by one, and do the corresponding gets in the primary database based on the retrieved keys.
    Though, there may be another option that should be taken into consideration, if you are willing to handle more work in your source code, that is, having a database that acts as a secondary, in which you'll update the records manually, with regard to the modifications performed in the primary db, without ever associating it with the primary database. This "secondary" would have <master> as key, and <std_id>, <name> (and other fields if you want to) as data. Note that for every modification that your perform on the std_info database you'll have to perform the corresponding modification on this database as well. You'll then be able to do the DBC->c_get() calls on this database with the DB_MULTIPLE flag specified.
    I have other question.is there any way that fetch information with number of record?
    for example fetch information that located third record of my database.I guess you're refering to logical record numbers, like the relational database's ROW_ID. Since your databases are organized as BTrees (without the DB_RECNUM flag specified) this is not possible directly.You could perform this if use a cursor and iterate through the records, and stop on the record whose number is the one you want (using an incrementing counter to keep track of the position). If your database could have operated with logical record numbers (BTree with DB_RECNUM, Queue or Recno) this would have been possible directly:
    http://www.oracle.com/technology/documentation/berkeley-db/db/ref/am_conf/logrec.html
    http://www.oracle.com/technology/documentation/berkeley-db/db/ref/am_conf/renumber.html
    Regards,
    Andrei

  • Join Table from a set of records

    I will try to explain the best I can...
    In the first code; I have assigned my UNION result set to BCALC.  
    How do I modify the second query so I will get all records from BCALC and all filtered records from second query in one result set?
    First Query:
    SELECT * FROM (
    SELECT bc.SpecId, bc.EmpNo, e.LastName, e.FirstName, rcd.EarningsCode, bc.FinalPayoutDollars, eh.CompanyNo,
    FROM Speculations bc, Employees e, RoleCodeDefs rcd, PeriodDefs p, EmpHist eh, vw_RollupPortfolios rp
    WHERE
    bc.EmpNo=e.EmpNo
    AND bc.PeriodId=p.PeriodId
    AND bc.RoleCode = rcd.RoleCode
    UNION
    SELECT bc.SpecId, bc.EmpNo, e.LastName, e.FirstName, rcd.EarningsCode, bc.FinalPayoutDollars, c.CompanyNo,
    FROM Speculations bc, Employees e, RoleCodeDefs rcd, dbo.afn_CommunityLookup() c
    WHERE
    bc.EmpNo=e.EmpNo
    AND bc.PeriodId=p.PeriodId
    AND bc.RoleCode = rcd.RoleCode
    AND bc.RoleCode <> 'MS'
    ) BCALC
    Second Query:
    select 'IBDX' AS EarningsCode,
    ROUND(BCALC.FinalPayoutDollars * dbo.udsf_GetInfo(BCALC.EmpNo, otpr.PeriodStartDate), 2) as FinalPayoutDollars
    from otprhours otpr, BCALC
    WHERE otpr.EmpNo=BCALC.EmpNo

    Query1 returns record from two select statement;  I need to insert new records (or UNION) in it form Query2 which contains a field reference to Query1 and a where clause (Query1.EmpNo = Query2.EmpNo).
    Basically, for each EmpNo in Query1; look into Query2. If EmpNo matches; insert a new record in Query1 with the values of EarningsCode and FinalPayoutDollars as in Query2.
    Query1:
    SELECT bc.SpecId, bc.EmpNo, e.LastName, e.FirstName, rcd.EarningsCode, bc.FinalPayoutDollars, eh.CompanyNo,
    FROM Speculations bc, Employees e, RoleCodeDefs rcd, PeriodDefs p, EmpHist eh, vw_RollupPortfolios rp
    WHERE
    bc.EmpNo=e.EmpNo
    AND bc.PeriodId=p.PeriodId
    AND bc.RoleCode = rcd.RoleCode
    UNION
    SELECT bc.SpecId, bc.EmpNo, e.LastName, e.FirstName, rcd.EarningsCode, bc.FinalPayoutDollars, c.CompanyNo,
    FROM Speculations bc, Employees e, RoleCodeDefs rcd, dbo.afn_CommunityLookup() c
    WHERE
    bc.EmpNo=e.EmpNo
    AND bc.PeriodId=p.PeriodId
    AND bc.RoleCode = rcd.RoleCode
    Query2:
    SELECT 'IBDX' AS EarningsCode,
    ROUND(Query1.FinalPayoutDollars * dbo.udsf_GetInfo(Query1.EmpNo, otpr.PeriodStartDate), 2) as FinalPayoutDollars
    from otprhours otpr, Query1
    WHERE otpr.EmpNo=BCALC.EmpNo

  • Query for a Value Set

    Is there any way to get one record for each of orgs? I would like to use this query in a value set but I can put the word distinct in a value set SQL statement. Any Ideas?
    SELECT
    haou.NAME ORGANIZATION_NAME
    FROM
    hr.per_all_assignments_f paaf,
    hr_all_organization_units haou
    WHERE haou.Organization_id = paaf.Organization_id
    AND paaf.primary_flag = 'Y'
    AND paaf.assignment_type = 'E'
    AND sysdate BETWEEN paaf.effective_start_date AND paaf.effective_end_date
    order by 1

    Found it...
    select name from hr_all_organization_units b
    where organization_id in (select organization_id from per_all_assignments_f a
    where a.organization_id = b.organization_id )
    order by 1

  • How to select a row from duplicate set of records?

    I want to select a row from a duplicate set of records.
    below is the explanation of my requirement.
    select * from test_dup;
    COL_BILL     COL_SERV     COL_SYS
    b1     s1     c
    b1     s1     g
    b1     s2     c
    b1     s2     g
    b2     s2     g
    b2     s3     c
    b2     s3     g
    b3     s3     c
    Here what I want is, for a distinct col_sys if col_bill and col_serv is same then I need the row where col_sys='c'
    from the above result set I need the following:
    b1     s1     c
    b1     s2     c
    b2     s3     c
    I am using the following SQL query which is giving me the correct result set. But it will hamper the performance because there are total 45 columns in the table and total volume is around 50 million.
    select * from test_dup where col_bill||col_serv in (
    select col_bill||col_serv from (
    select col_bill,col_serv,count(*) from test_dup
    where col_sys in ('c','g')
    group by col_bill,col_serv having count(*) >1)) and
    col_sys='c';
    Can anyone please provide me the optimize SQL query for the same.

    Hi,
    Another way,
    SQL> with test_dup
    as
         select 'b1' col_bill, 's1' col_serv, 'c' col_sys from dual union all
         select 'b1', 's1', 'g' from dual union all
         select 'b1', 's2', 'c' from dual union all
         select 'b1', 's2', 'g' from dual union all
         select 'b2', 's2', 'g' from dual union all
         select 'b2', 's3', 'c' from dual union all
         select 'b2', 's3', 'g' from dual union all
         select 'b3', 's3', 'c' from dual
      select col_bill, col_serv, min(col_sys) col_sys
        from test_dup
       where col_sys in ('c', 'g')
    group by col_bill, col_serv
      having count( * ) > 1
         and count(nullif(col_sys, 'g')) > 0;
    CO CO C
    b1 s1 c
    b2 s3 c
    b1 s2 c
    3 rows selected.Regards
    Peter
    Edited by: Peter on Feb 18, 2009 1:10 AM
    - Added test data, thanks Karthick

  • Find the last value of one set of records

    Hi friends,
    i have e set of records
    Customer_old_id customer_new_id start_date
    1001 1010 01-jan-07
    1010 1051 15-feb-08
    1051 1070 01-jan-09
    5001 5020 01--jan-05
    5020 5100 01-jun-06
    I would like to create a new set of records with values
    Customer_old_id customer_new_id start_date customer_last_id last_date
    1001 1010 01-jan-07 1070 01-jan-09
    1010 1051 15-feb-08 1070 01-jan-09
    1051 1070 01-jan-09 1070 01-jan-09
    5001 5020 01--jan-05 5100 01-jun-06
    5020 5100 01-jun-06 5100 01-jun-06
    Thanks in Advance
    Mark

    Hi, Mark,
    INSERT INTO table_x
    (     customer_old_id
    ,     customer_new_id
    ,     start_date
    ,     customer_last_id
    ,     last_date
    SELECT     customer_old_id
    ,     customer_new_id
    ,     start_date
    ,     CONNECT_BY_ROOT customer_new_id     -- customer_last_id
    ,     CONNECT_BY_ROOT start_date     -- last_date
    FROM     table_x
    START WITH     customer_new_id     NOT IN     (
                             SELECT     customer_old_id
                             FROM     table_x
    CONNECT BY     custormer_new_id     = PRIOR customer_old_id;(Untested)
    You have a parent-child relationshiip. If a row has customer_new_id = x, then the row with customer_old_id = x is its parent. That relationship is spelled out in the CONNECT BY clause. (Perhaps you normally think of the parent-child roles as being the opposite of what I described. That's fine, but there is no CONNECT_BY_LEAF operator, only CONNECT_BY_ROOT, so for purposes of this query, the rows with the values that need to be copied to all their relatives are the roots.)
    If a row has customer_new_id = x, but there is no row where customer_old_id = x, then that row has no parent: it is a root. Those rows are found in the START WITH clause.
    The customer_new_id and start_date become the customer_last_id and last_date of each root and all its descendants. CONNECT_BY_ROOT retains these values as the query traverses the tree, from parent to child.

  • Picking unique records from huge set of records

    Hi db experts,
    Could anyone help me in having a query which is based on partitioned table with 400,00,000 records each day . It has member number unique and I want to pick unique ones say for dates between 20-jan-2007 and 20-apr-2007.
    How can I proceed to write query. Am expecting query which will only pull unique records in less possible time.
    Thanks in advance
    Ravikanth

    The table has 400 lakh records each day my mistake - I misread the original post.
    Is this a one-off exercise or an ongoing requirement? What are you going to do with the data once you've got it - do you need more columns than the numbers? Do you have a feel for how many unique numbers there are per day and over the entire quarter?
    The easiest way to do this would probably be to create an extract table (maybe a temporary one) and vary the query I posted to insert the unique numbers into this table for each day i.e. run it multiple times against a smaller data set. Then you can select the unique numbers from the extract table to get the finished set.
    Of course, whether this is a viable solution depends on the answers to the questions I posed above. The more information you give us the easier it is for us to advise you.
    Cheers, APC

  • Select query-using Union All display duplicate records.

    Hello All Gurus-
    I am using Oracle 9.i
    When i use the following query to fetch the records based on BUILDNUMBERNAME and ASSIGNED_BUILD then i am getting duplicate records -
    select T1.ID FROM Defect T1,statedef T2,repoproject T3
    WHERE T1.STATE=T2.ID AND T1.repoproject = T3.dbid AND T3.name Like 'ABC' AND T1. ASSIGNED_BUILD like '1.4.5.6'
    Union All
    select T1.ID FROM Defect T1,statedef T2,repoproject T3
    WHERE T1.STATE=T2.ID AND T1.repoproject = T3.dbid AND T3.name Like 'ABC' AND T1.BUILDNUMBERNAME like '1.4.5.6'
    How can i use the order by on T1.ID ? When i use the Order by T1.ID then it throws some error.
    Kindly help me in this :(
    Thanks in advance.

    Sorry for not providing all of the details -
    I am using Toad tool to run the query.
    1-When i use the following query -
    Select T1.ID FROM Defect T1,statedef T2,repoproject T3
    WHERE T1.STATE=T2.ID AND T1.repoproject = T3.dbid AND T3.name Like 'ABC' AND T1. ASSIGNED_BUILD like '1.4.5.6' order by T1.ID
    Union All
    select T1.ID FROM Defect T1,statedef T2,repoproject T3
    WHERE T1.STATE=T2.ID AND T1.repoproject = T3.dbid AND T3.name Like 'ABC' AND T1.BUILDNUMBERNAME like '1.4.5.6' order by T1.ID
    ORA-00933: SQL command not properly ended.
    2-If i am not using the T1.ID and run the following query
    Select T1.ID FROM Defect T1,statedef T2,repoproject T3
    WHERE T1.STATE=T2.ID AND T1.repoproject = T3.dbid AND T3.name Like 'ABC' AND T1. ASSIGNED_BUILD like '1.4.5.6'
    Union All
    select T1.ID FROM Defect T1,statedef T2,repoproject T3
    WHERE T1.STATE=T2.ID AND T1.repoproject = T3.dbid AND T3.name Like 'ABC' AND T1.BUILDNUMBERNAME like '1.4.5.6'
    Then it is running fine but it is displaying the duplicate values like -
    00089646
    00087780
    00089148
    00090118
    00090410
    00088503
    00080985
    00084526
    00087108
    00087109
    00087117
    00088778
    00086714
    00079518
    00087780
    00089148
    00090392
    00090393
    00090395
    00090398
    00090401
    00090402
    00090403
    00090406
    00090408
    00088503
    00080985
    00084526
    00087108
    00087109
    00087117
    00088778
    00086714
    00079518

Maybe you are looking for

  • How to use search help in abap dynpro

    i have created a search help in dictionary and used it in my database table. now i want to use it in web dynpro component. while running my application when im clicking on input help field, it is giving an error -"The Entered Values is not on the lis

  • How to unlock a carrier locked iPad 1?

    I have a iPad that was bought on contract on Orange. I have a 3 sim and when I try it, I get a message in iTunes "The Sim card inserted in this iPad does not appear to be supported" I am guessing it is carrier locked, I have found a few people on the

  • Upgrading via App Store vs. Regular Upgrade

    App Store version is $20 cheaper than upgrading, but will it "upgrade" me without losing all my settings, plugins, etc? While I'd like to save the $20, it's not worth it if I have to reconfigure everything. Thanks

  • How to customize Details dialog?

    Hi everyone, I’ve created an iView and I would like to add it into folder details dialog. It is possible? How it could be done? Thanks in advanced, Alcides Flach

  • Is Oracle Identity Management 11g Patch Set 5 (11.1.1.6.0) reqd for Essbase

    In the Media pack Readme for parts required to be downloaded for different EPM products, Essbase has Oracle Identity Management 11g Patch Set 5 (11.1.1.6.0) for Microsoft Windows x86 (64-bit) listed. Can someone please tell me if this is a must have.