Query - to fetch records - before particular date

I need to retrive last analyzed table prior to 28/Nov/2010 - to put into simple wanted to fetch records from a table which are created before the above mentioned date.
Thanks,
Steve

Spade wrote:
I need to retrive last analyzed table prior to 28/Nov/2010 - to put into simple wanted to fetch records from a table which are created before the above mentioned date.
Thanks,
SteveYou want to fetch the rows which were "inserted" before that date?
Then you either:
a) Need to have a timestamp column on the row or
b) Use ORA_ROWSCN pseudo-column if you created your table(s) with row-level dependency tracking or
c) Install log miner and query the necessary archive logs.
:p

Similar Messages

  • 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

  • Query for onhand  qunatity  with particular date  for eam

    hi all ,
    following query are showing wrong value for on hand quantity with particular date mean work order issue date for quantity .
    can u show me where is problem in this query.
    SELECT   ood.organization_name, wrov.concatenated_segments item_number,
             wrov.item_description description, wrov.item_primary_uom_code uom,
            -- SUM (on_hand.on_hand) quantity_in_stock,
              SUM (on_hand.on_hand) + wrov.quantity_issued quantity_in_stock,
             we.wip_entity_name work_order_number,
             TRUNC (we.creation_date) work_order_date,
             fu.user_name work_order_made_by, wrov.quantity_issued,
             trunc(cic.material_cost,2) issue_rate_per_qty,
             wrov.quantity_issued * trunc(cic.material_cost,2) quantity_value,
             --SUM (on_hand.on_hand) - wrov.quantity_issued balace_qty,
             SUM (on_hand.on_hand)  balace_qty,
               SUM (on_hand.on_hand)
             * trunc(cic.material_cost,2) COST,
             eam.ATTRIBUTE1 EQUIPEMENT_NO
            --  gcc.SEGMENT6 equipement_no
        FROM wip_entities we,
             wip_requirement_operations_v wrov,
             org_organization_definitions ood,
             mtl_onhand_total_mwb_v on_hand,
             fnd_user fu,
             cst_item_costs cic,
             eam_work_orders_v eam
    --                    gl_code_combinations gcc,
    --                    WIP_TRANSACTION_ACCOUNTS  wta ,
    --                    WIP_TRANSACTIONS wt
       WHERE wrov.wip_entity_id = we.wip_entity_id
         AND ood.organization_id = wrov.organization_id
         AND wrov.inventory_item_id = on_hand.inventory_item_id
         AND on_hand.organization_id = ood.organization_id
         AND we.created_by = fu.user_id(+)
         AND cic.inventory_item_id = wrov.inventory_item_id
         AND cic.organization_id = wrov.organization_id
         --AND we.wip_entity_name = '179542'
         AND wrov.organization_id = nvl(:organization_id,wrov.organization_id)
                AND (we.wip_entity_name = :job_order_No OR :job_order_No IS NULL)
                and trunc(we.creation_date) between  nvl(:from_date ,trunc(we.creation_date)) and nvl(:too_date ,trunc(we.creation_date))
               and eam.WIP_ENTITY_NAME=we.wip_entity_name
               and eam.WORK_ORDER_STATUS in('Complete','Complete - No Charges' ,'Released')
    --                 and gcc.CODE_COMBINATION_ID  =wta.REFERENCE_ACCOUNT
    --                 and wta.TRANSACTION_ID =wt.TRANSACTION_ID
    --                 and we.wip_entity_id  =wta.WIP_ENTITY_ID
    GROUP BY ood.organization_name,
             wrov.concatenated_segments,
             wrov.item_description,
             wrov.item_primary_uom_code,
             we.wip_entity_name,
             we.creation_date,
             fu.user_name,
             wrov.quantity_issued,
             cic.material_cost,
              eam.ATTRIBUTE1
           --  gcc.SEGMENT6
           order by we.wip_entity_name

    I don't think there is any special predicate to do that, Code is simply getting all children of given asset and returning them (Offcource there is some ordering logic). If You want exact informaiton I would suggest to use json call that DAM is making i.e.
    HOST:POST/<PATH OF DAM>.assets.json
    Or decompile AssetListServlet.java ans see how it is implemeted
    Yogesh
    www.wemblog.com

  • Writing OR query for fetching records

    Hi,
    I have dowloaded a custom wsdl and generated a java client from it using Jdeveloper.
    I have a method named customObject1QueryPage(QueryInputObj) which is used to query the CRM oD to fetch records.
    I have successfully queried using the above method for one condition:-
    QueryInputObj param= new QueryInputObj();
    QueryType q = new QueryType();
    q.set_value("='" + "ABC'");
    //q.set_value("LIKE 'A*'");
    param.setAccountName(q);
    customObject1QueryPage(param);
    But now I want to query using "OR" condition with multiple names in the condition and I don't know how to
    write query for that.
    SQL query would be like "Select * from table where name='ABC' OR name='PQR' OR name ='XYZ' ";
    I want to execute same query for CRM oD but have no idea how to write it.
    Can somebody please help me as soon as possible.
    Thanks.

    Hi,
    If your intent to Use OR Condition on a field with multiple Values
    say, AccountName = 'xyz' OR AccountName= 'abc' the syntax would be *(='xyz') OR (='abc')*
    say, AccountName = 'xyz' OR AccountName= 'abc' OR AccountName = 'pqr' the syntax would be *((='xyz') OR (='abc'))OR(='pqr')*
    You can find similar example under On Demand Web Service Documentation
    Regards
    Deepak H Andeli

  • Sql query to fetch record datewise and hourwise

    I have a table say ABC with column key and date
    like
    key date
    charge 4/11/2009 00:46:20 AM
    reload 3/27/2008 12:46:20 AM
    auto 3/27/2008 07:46:20 AM
    now i want that the count for column key is selected
    datewise and hour wise
    like for a particular date for hour between
    0000-0001
    0001-0002
    2300-2400
    the no of different key column values come
    i.e
    for date 4.11.09 hour 2300-2400
    charge=5
    auto=2
    reload=8
    how could it be acheived
    thanks in advance

    Ok, if you want to get all the data for one particular day, you need to know that the times in the DATE format run from 00:00:00 to 23:59:59 on one day. Therefore there is no concept of 24:00:00 as a time for today, because that's equivalent to 00:00:00 of tomorrow!
    If you do:
    select keyword, trunc(transaction_time, 'hh'), count(*)
    from   tid_master
    where  transaction_time >= to_date('04.11.2009' || ' 0000','mm.dd.yyyy hh24mi')
    and    transaction_time < to_date('04.11.2009' || ' 0000','mm.dd.yyyy hh24mi') + 1
    group by keyword, trunc(transaction_time, 'hh')Then you get all the results for the 11th April 2009. (Side note: please note that I have specified four digits for the year - this is good practice, as "09" could refer to 1909, 2009, 2109, etc, and the db could potentially pick one that you're not expecting! Always be explicit - dates have four digit years, therefore enter them as four digits. The Y2K bug was not all that long ago!).
    You'd do the above with a variable like:
    select keyword, trunc(transaction_time, 'hh'), count(*)
    from   tid_master
    where  transaction_time >= trunc(your_date_variable)
    and    transaction_time < trunc(your_date_variable) + 1
    group by keyword, trunc(transaction_time, 'hh')If you don't have an index on the transaction_time column, then it's ok to do this:
    select keyword, trunc(transaction_time, 'hh'), count(*)
    from   tid_master
    where  trunc(transaction_time) = trunc(your_date_variable)
    group by keyword, trunc(transaction_time, 'hh')You could replace your variable with sysdate etc.

  • How to write ABAP Logic in SAP Query to fetch records from many Tables

    Hi Expert,
    I have one requirement, want to display all BOM (Equipment BOM, Function Location BOM and Meterial BOM) from a particular plant.
    List of tables as below:
    EQST: Equipment to BOM Link
    TPST: Link Between Functional Location and BOM
    MAST: Material to BOM Link
    STPO:BOM item
    Requirement: When user enters Plant then SAP Query should execute and fetch all BOMs (as mentioned above) from STPO Table.
    I have done so far is as follows:
    I create User Group, Infoset and SAP Query.
    While creating INFOSET, i used 4 tables (EQST,TPST,MAST & STPO) and link between then is as follows:
    STPO-STLNR ---> EQST-STLNR : Left Outer Join
    STPO-STLNR ---> TPST-STLNR : Left Outer Join
    STPO-STLNR ---> MAST-STLNR : Left Outer Join
    Now its showing all BOM from all plants though I enter one Plant value.
    Please advise me to write SAP Query and Logic to fetch all BOM from selected Plant Value.
    Thanks,
    Jay.
    Edited by: jaykrishna007 on Jul 29, 2011 11:41 AM

    Hi FCannavo,
    Thanks for your quick reply.
    See, now I changed my Infoset design.
    I added one Plant Table (T001W) and then
    T001W-WERKS--->EQST-WERKS
    T001W-WERKS--->MAST-WERKS
    T001W-WERKS--->TPST-WERKS
    and then
    EQST-STLNR--->STPO-STLNR
    MAST-STLNR--->STPO-STLNR
    TPST-STLNR--->STPO-STLNR
    on selection screen, user will enter Plant Value.
    Now its showing some records, but i dont think so i would be correct output or not, please guide me whether it is correct or not?
    Thanks,
    Jay.

  • Querying wide (multi-record case) table data in oracle 10g

    I've got a set of "wide" (multi-record case data format) tables similar to the format described in Oracle's "Oracle Data Mining Concepts" book in chapter 2 (http://download-west.oracle.com/docs/cd/B14117_01/datamine.101/b10698/2data.htm#1010394).
    I like the flexibility of this format, especially since it can handle thousands of attributes. But the main problem I have with this format is in determining how to write efficient, complex queries against the data.
    I've included some sample data below to demonstrate my problem. I've got two tables, one with people and the other with the attributes and values of age, income, height and weight. If I try to generate a complex query against this data, I seem to either have to rely on multisets and functions, or on a large number of self joins. Neither of which seems to scale well or perform well for large amounts of data. I know I could also add a pipelined TABLE function to filter the data more, but none of these options seem like great solutions. Does anyone have any ideas for a better way to form complex well performing queries against this type of data layout?
    For example, with my sample data below I'd like to select everyone whose (income = 2000) or (income = 50000 and weight = 210), but the only way I see of doing this is with a query like the following (which won't take advantage of any indexes on the data):
    select * from people_attributes_view
    where find_eq_attr(AttributeValue('income',2000),attribute_values) is not null
    or (find_eq_attr(AttributeValue('income',50000),attribute_values) is not null
    and
    find_eq_attr(AttributeValue('weight',210),attribute_values) is not null);
    Any help is greatly appreciated.
    Thanks.
    -- My full example starts here ----------------
    -- Create the sample tables and data
    create table people (id int, name varchar(30));
    create table attributes (id int, attribute varchar(10), value NUMBER);
    insert into people values (1,'tom');
    insert into people values (2,'jerry');
    insert into people values (3,'spike');
    commit;
    insert into attributes values (1,'age',23);
    insert into attributes values (1,'income',1000);
    insert into attributes values (1,'height',5);
    insert into attributes values (1,'weight',120);
    insert into attributes values (2,'age',20);
    insert into attributes values (2,'income',2000);
    insert into attributes values (3,'age',30);
    insert into attributes values (3,'income',50000);
    insert into attributes values (3,'weight',210);
    commit;
    -- Create some types, functions and views for the search
    CREATE OR REPLACE TYPE AttributeValue AS OBJECT
    (attribute varchar(30),
    value NUMBER);
    CREATE OR REPLACE TYPE AttributeValues AS TABLE OF AttributeValue;
    create or replace function find_eq_attr (val AttributeValue, vals AttributeValues) RETURN AttributeValue IS
    begin
    for i in vals.FIRST .. vals.LAST
    LOOP
    if ((val.attribute = vals(i).attribute) and
    (val.value = vals(i).value)) then
    return vals(i);
    end if;
    END LOOP;
    return null;
    end;
    create or replace view people_attributes_view as
    select p.name, p.id,
    cast(multiset(select attribute,value from attributes a where a.id = p.id)
    as AttributeValues) attribute_values
    from people p;
    -- Search for everyone whose (income = 2000) or (income = 50000 and weight = 210)
    select * from people_attributes_view
    where find_eq_attr(AttributeValue('income',2000),attribute_values) is not null
    or (find_eq_attr(AttributeValue('income',50000),attribute_values) is not null
    and
    find_eq_attr(AttributeValue('weight',210),attribute_values) is not null);

    I like the flexibility of this format, especially
    since it can handle thousands of attributes. But the
    main problem I have with this format is in
    determining how to write efficient, complex queries
    against the data. Can't be done. The flexibility is achieved at the cost of simplicity and performance, it is a trade off.
    See this thread for a full discussion on the subject.
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:10678084117056

  • Issue with fetching records when SalesForce Date Fields involved

    Using the Events application of Salesforce I enter a record of data.  The record has a Start Date of Monday and an End Date of Friday for a given week.  Crystal will not fetch/display the record in the report.  If I go back and change the Start Date and the end Date to teh same day, the record will print in Crystal.
    Is there some Date flag within Crystal that I need to toggle allowing a record to print based on date ranges?  I don't understand why a record would print when Start and End Date are the same but will not print when different?

    Here is the code....  I have also noticed that there are three fields - Start Date, End Date and Due Date.  Only when all 3 fields are set to the same value within Salesforce will the record print in Crystal.  I have tried removing any reference to the Date fields in the crystal report but its not helping
    www.salesforce.com
    SELECT Name, Id
    FROM   Account
    EXTERNAL JOIN Account.Id={?www.salesforce.com: Event.AccountId}
    www.salesforce.com
    SELECT ActivityDate, CAT_Type__c, Subject, Location, PO_Number__c, CO_Number__c, Is_Closed__c, Description, Submit_For_Invoice__c, Is_Scheduled__c, Status__c, RecurrenceStartDateTime, RecurrenceEndDateOnly, OwnerId, AccountId
    FROM   Event
    WHERE  (CAT_Type__c='Remote Support - Non Revenue' OR CAT_Type__c='Remote Support - Revenue' OR CAT_Type__c='Travel - Non Revenue' OR CAT_Type__c='Travel - Revenue') AND (Status__c='Closed' OR Status__c='Complete - Not Closed' OR Status__c='Open')
    EXTERNAL JOIN Event.AccountId={?www.salesforce.com: Account.Id} AND Event.OwnerId={?www.salesforce.com: User.Id}
    www.salesforce.com
    SELECT LastName, Id
    FROM   User
    EXTERNAL JOIN User.Id={?www.salesforce.com: Event.OwnerId}

  • CANNOT QUERY SAME DETAIL RECORD IN SECOND DATA PAGE

    Hello,
    We created a Master-->DetailOne-->DetailTwo Business Component Diagram. Added two Data Pages (UIX) to Struts Config diagram. First data page contains Master-->DetailOne (One-To-Many) view from Data Control Palette, and the second data page has DetailOne-->DetailTwo (One-To_Many).
    Our intent is for user to pick a DetailOne record from first page and click a link button to load the second data page with same DetailOne record and any DetailTwo records available underneath. Tried adding a DataAction component to the diagram and dragged several Data Control Operations to it. However our second data page does not load the same DetailOne record as the first one. We also tried data linking first page to second. The second datapage does not display the record selected on first data page when clicking on the link button. Uploading screen shots to clarify issue. Please advise if you need
    additional information.
    Thanks, Ali.

    Hi Judy,
    It's been 5-6 months since I've created a Master/Detail APEX application, but I don't remember having to create any special trigger or anything. I created a few maintenance appls over tables I created, and created an inquiry appl using Oracle vendor tables. All of them have worked nicely.
    If the PK/FK's are set up correctly it just works. :-) Like magic. If I recall correctly, as you create the appl you define the the key fields to use. If the tables are defined correctly, and you 'tie' them together using the correct key fields in the application everything should work nicely.
    Tony

  • Query to generate inventory of particular date, including vendor,base_ref

    Hi,
    Below is the query that I get from SCN and modify it to meet with own requirement, but it seem that it doesn't work, can anyone help?
    I want to include T0.BASE_REF, T0.CardCode, T0.CardName
    SELECT T1.WhsName, T0.ItemCode, Max(T0.Dscription) 'Item Name', SUM(T0.InQty-T0.OutQty) 'On Hand', T0.BASE_REF, T0.CardCode, T0.CardName
    FROM OINM T0
    JOIN OWHS T1 ON  T1.WhsCode=T0.Warehouse
    WHERE T0.[DocDate] <=[%0] AND T0.[CardCode] = [%1]
    GROUP BY T1.WhsName,T0.ItemCode, T0.BASE_REF, T0.CardCode, T0.CardName
    Having SUM(T0.InQty-T0.OutQty) > 0
    Thanks

    Hi,
    Inventory audit report is to display the stock movement and item cost based on whse on certain date and other selection criteria or parameter.
    You can try to enhance this following query to add the vendor code:
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @itemgrp nvarchar(10)
    select @FromDate = min(tx.Docdate) from dbo.OINM tx where tx.Docdate >='10/01/2012'
    select @ToDate = max(sx.Docdate) from dbo.OINM sx where sx.Docdate <='10/30/2012'
    select @itemgrp = Max(s3.ItmsGrpCod) from dbo.OINM S2 inner join oitm s3 on s2.itemcode = s3.ItemCode
    Where S3.ItmsGrpCod = '112'
    Select a.Itemcode, max(a.Dscription) as ItemName, a.Warehouse,
    sum(a.OpeningBalance) as OpeningBalance, sum(a.INq) as 'IN', sum(a.OUT) as OUT,
    ((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing ,
    (Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM
    from( Select N1.Warehouse, N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty))
    as OpeningBalance, 0 as INq, 0 as OUT From dbo.OINM N1
    inner join OITM n2 on n2.ItemCode = n1.ItemCode
    Where N1.DocDate < @FromDate and n2.ManBtchNum <> 'y'
    and N2.ItmsGrpCod = @itemgrp
    Group By N1.Warehouse,N1.ItemCode,
    N1.Dscription
    Union All
    select N1.Warehouse, N1.Itemcode, N1.Dscription, 0 as OpeningBalance,
    sum(N1.inqty) , 0 as OUT From dbo.OINM N1
    inner join OITM n2 on n2.ItemCode = n1.ItemCode
    Where N1.DocDate >= @FromDate and N1.DocDate <= @ToDate
    and N1.Inqty >0  and n2.ManBtchNum <> 'y'
    and N2.ItmsGrpCod = @itemgrp
    Group By N1.Warehouse,N1.ItemCode,N1.Dscription
    Union All
    select N1.Warehouse, N1.Itemcode, N1.Dscription, 0 as OpeningBalance, 0 , sum(N1.outqty) as OUT
    From dbo.OINM N1
    inner join OITM n2 on n2.ItemCode = n1.ItemCode
    Where N1.DocDate >= @FromDate and N1.DocDate <=@ToDate and N1.OutQty > 0 and n2.ManBtchNum <> 'y'
    and N2.ItmsGrpCod = @itemgrp
    Group By N1.Warehouse,N1.ItemCode,N1.Dscription) a, dbo.OITM I1
    where a.ItemCode=I1.ItemCode
    Group By a.Itemcode , a.Warehouse
    Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0 Order By a.Itemcode
    --order by a.Warehouse, a.ItemCode
    Good luck
    Rgds,
    JM

  • Af:query not fetching records when VC Modified for advance search

    Gurus,
    I have a view criteria and using it i have a af:query component in my page. When i run the page i see the fields in the search box correctly. However i see another LOV in the search which has options like "Equals","Between", "Does not contain" etc. Though this option is good for 1 search criteria, it is not of any use for another. How can i remove it from the search criteria that i dont want
    thnks
    Jdev 11.1.1.5.

    you would need to add the following to the view criteria item in the view criteria definition for the VO - in order NOT to show any of the operators.
    <CompOper
                Name="DepartmentName"
                ToDo="-2"
                Oper="">You would need to do - by open the VO.xml and add this xml snippet - which would ensure that the operators are NOT shown in the query panel.
    Sample:
    For Departments VO, say there is a view criteria that defined on department id and department name and you do NOT want to show the operators.
    After defining the VC, open the VO file - add the above.
    <ViewCriteria
    Name="DepartmentsVOByDeptIdorDeptName"
    ViewObjectName="com.samples.model.DepartmentsVO"
    Conjunction="AND">
    <Properties>
    <CustomProperties>
    <Property
    Name="displayOperators"
    Value="Always"/>
    <Property
    Name="autoExecute"
    Value="false"/>
    <Property
    Name="allowConjunctionOverride"
    Value="true"/>
    <Property
    Name="showInList"
    Value="true"/>
    <Property
    Name="mode"
    Value="Basic"/>
    </CustomProperties>
    </Properties>
    <ViewCriteriaRow
    Name="vcrow0"
    UpperColumns="1">
    <ViewCriteriaItem
    Name="DepartmentsVOCriteria_vcrow0_DepartmentId"
    ViewAttribute="DepartmentId"
    Operator="="
    Conjunction="AND"
    Required="Optional"/>
    <ViewCriteriaItem
    Name="DepartmentsVOCriteria_vcrow0_DepartmentName"
    ViewAttribute="DepartmentName"
    Operator="STARTSWITH"
    Conjunction="AND"
    Required="Optional">
    *<CompOper*
    Name="DepartmentName"
    ToDo="-2"
    Oper="">
    *</CompOper>*
    </ViewCriteriaItem>
    </ViewCriteriaRow>
    </ViewCriteria>
    Thanks,
    Navaneeth

  • SQL Query to fetch records from tables which have 75+ million records

    Hi,
    I have the explain plan for a sql stmt.Require your suggestions to improve this.
    PLAN_TABLE_OUTPUT
    | Id  | Operation                            | Name                         | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT                     |                              |   340 |   175K| 19075 |
    |   1 |  TEMP TABLE TRANSFORMATION           |                              |       |       |       |
    |   2 |   LOAD AS SELECT                     |                              |       |       |       |
    |   3 |    SORT GROUP BY                     |                              |    32M|  1183M|   799K|
    |   4 |     TABLE ACCESS FULL                | CLM_DETAIL_PRESTG            |   135M|  4911M|   464K|
    |   5 |   LOAD AS SELECT                     |                              |       |       |       |
    |   6 |    TABLE ACCESS FULL                 | CLM_HEADER_PRESTG            |     1 |   274 |   246K|
    PLAN_TABLE_OUTPUT
    |   7 |   LOAD AS SELECT                     |                              |       |       |       |
    |   8 |    SORT UNIQUE                       |                              |   744K|    85M|  8100 |
    |   9 |     TABLE ACCESS FULL                | DAILY_PROV_PRESTG            |   744K|    85M|  1007 |
    |  10 |   UNION-ALL                          |                              |       |       |       |
    |  11 |    SORT UNIQUE                       |                              |   177 | 97350 |  9539 |
    |  12 |     HASH JOIN                        |                              |   177 | 97350 |  9538 |
    |  13 |      HASH JOIN OUTER                 |                              |     3 |  1518 |  9533 |
    |  14 |       HASH JOIN                      |                              |     1 |   391 |  8966 |
    |  15 |        TABLE ACCESS BY INDEX ROWID   | CLM_DETAIL_PRESTG            |     1 |    27 |     3 |
    |  16 |         NESTED LOOPS                 |                              |     1 |   361 |    10 |
    |  17 |          NESTED LOOPS OUTER          |                              |     1 |   334 |     7 |
    PLAN_TABLE_OUTPUT
    |  18 |           NESTED LOOPS OUTER         |                              |     1 |   291 |     4 |
    |  19 |            VIEW                      |                              |     1 |   259 |     2 |
    |  20 |             TABLE ACCESS FULL        | SYS_TEMP_0FD9D66C9_DA2D01AD  |     1 |   269 |     2 |
    |  21 |            INDEX RANGE SCAN          | CLM_PAYMNT_CLMEXT_PRESTG_IDX |     1 |    32 |     2 |
    |  22 |           TABLE ACCESS BY INDEX ROWID| CLM_PAYMNT_CHKEXT_PRESTG     |     1 |    43 |     3 |
    |  23 |            INDEX RANGE SCAN          | CLM_PAYMNT_CHKEXT_PRESTG_IDX |     1 |       |     2 |
    |  24 |          INDEX RANGE SCAN            | CLM_DETAIL_PRESTG_IDX        |     6 |       |     2 |
    |  25 |        VIEW                          |                              |    32M|   934M|  8235 |
    |  26 |         TABLE ACCESS FULL            | SYS_TEMP_0FD9D66C8_DA2D01AD  |    32M|   934M|  8235 |
    |  27 |       VIEW                           |                              |   744K|    81M|   550 |
    |  28 |        TABLE ACCESS FULL             | SYS_TEMP_0FD9D66CA_DA2D01AD  |   744K|    81M|   550 |
    PLAN_TABLE_OUTPUT
    |  29 |      TABLE ACCESS FULL               | CCP_MBRSHP_XREF              |  5288 |   227K|     5 |
    |  30 |    SORT UNIQUE                       |                              |   163 | 82804 |  9536 |
    |  31 |     HASH JOIN                        |                              |   163 | 82804 |  9535 |
    |  32 |      HASH JOIN OUTER                 |                              |     3 |  1437 |  9530 |
    |  33 |       HASH JOIN                      |                              |     1 |   364 |  8963 |
    |  34 |        NESTED LOOPS OUTER            |                              |     1 |   334 |     7 |
    |  35 |         NESTED LOOPS OUTER           |                              |     1 |   291 |     4 |
    |  36 |          VIEW                        |                              |     1 |   259 |     2 |
    |  37 |           TABLE ACCESS FULL          | SYS_TEMP_0FD9D66C9_DA2D01AD  |     1 |   269 |     2 |
    |  38 |          INDEX RANGE SCAN            | CLM_PAYMNT_CLMEXT_PRESTG_IDX |     1 |    32 |     2 |
    |  39 |         TABLE ACCESS BY INDEX ROWID  | CLM_PAYMNT_CHKEXT_PRESTG     |     1 |    43 |     3 |
    PLAN_TABLE_OUTPUT
    |  40 |          INDEX RANGE SCAN            | CLM_PAYMNT_CHKEXT_PRESTG_IDX |     1 |       |     2 |
    |  41 |        VIEW                          |                              |    32M|   934M|  8235 |
    |  42 |         TABLE ACCESS FULL            | SYS_TEMP_0FD9D66C8_DA2D01AD  |    32M|   934M|  8235 |
    |  43 |       VIEW                           |                              |   744K|    81M|   550 |
    |  44 |        TABLE ACCESS FULL             | SYS_TEMP_0FD9D66CA_DA2D01AD  |   744K|    81M|   550 |
    |  45 |      TABLE ACCESS FULL               | CCP_MBRSHP_XREF              |  5288 |   149K|     5 |
    The CLM_DETAIL_PRESTG table has 100 million records and the CLM_HEADER_PRESTG table has 75 million records.
    Any gussestions on how to getch huge records from tables of this size will help.
    Regards,
    Narayan

    WITH CLAIM_DTL
         AS (  SELECT
                      ICN_NUM,
    MIN (FIRST_SRVC_DT) AS FIRST_SRVC_DT,
    MAX (LAST_SRVC_DT) AS LAST_SRVC_DT,
    MIN (PLC_OF_SRVC_CD) AS PLC_OF_SRVC_CD
    FROM CCP_STG.CLM_DETAIL_PRESTG  CD WHERE ACT_CD <>'D'
    GROUP BY ICN_NUM),
    CLAIM_HDR
         AS (SELECT
                    ICN_NUM,
    SBCR_ID,
    MBR_ID,
    MBR_FIRST_NAME,
    MBR_MI,
    MBR_LAST_NAME,
    MBR_BIRTH_DATE,
    GENDER_TYPE_CD,
    SBCR_RLTNSHP_TYPE_CD,
    SBCR_FIRST_NAME,
    SBCR_MI,
    SBCR_LAST_NAME,
    SBCR_ADDR_LINE_1,
    SBCR_ADDR_LINE2,
    SBCR_ADDR_CITY,
    SBCR_ADDR_STATE,
    SBCR_ZIP_CD,
    PRVDR_NUM,
    CLM_PRCSSD_DT,
    CLM_TYPE_CLASS_CD,
    AUTHO_NUM,
    TOT_BILLED_AMT,
    HCFA_DRG_TYPE_CD,
    FCLTY_ADMIT_DT,
    ADMIT_TYPE,
    DSCHRG_STATUS_CD,
    FILE_BILLING_NPI,
    CLAIM_LOCATION_CD,
    CLM_RELATED_ICN_1,
    SBCR_ID||0
    || MBR_ID
    || GENDER_TYPE_CD
    || SBCR_RLTNSHP_TYPE_CD
    || MBR_BIRTH_DATE
    AS MBR_ENROLL_ID,
    SUBSCR_INSGRP_NM ,
    CAC,
    PRVDR_PTNT_ACC_ID,
    BILL_TYPE,
      PAYEE_ASSGN_CODE,
    CREAT_RUN_CYC_EXEC_SK,
    PRESTG_INSRT_DT
    FROM CCP_STG.CLM_HEADER_PRESTG P WHERE ACT_CD <>'D' AND SUBSTR(CLM_PRCSS_TYPE_CD,4,1) NOT IN  ('1','2','3','4','5','6')  ),
    PROV AS ( SELECT DISTINCT
    PROV_ID,
    PROV_FST_NM,
    PROV_MD_NM,
    PROV_LST_NM,
    PROV_BILL_ADR1,
    PROV_BILL_CITY,
    PROV_BILL_STATE,
    PROV_BILL_ZIP,
    CASE WHEN PROV_SEC_ID_QL='E' THEN PROV_SEC_ID
    ELSE NULL
    END AS PROV_SEC_ID,
    PROV_ADR1,
    PROV_CITY,
    PROV_STATE,
    PROV_ZIP
    FROM CCP_STG.DAILY_PROV_PRESTG),
    MBR_XREF AS (SELECT SUBSTR(MBR_ENROLL_ID,1,17)||DECODE ((SUBSTR(MBR_ENROLL_ID,18,1)),'E','1','S','2','D','3')||SUBSTR(MBR_ENROLL_ID,19) AS MBR_ENROLLL_ID,
      NEW_MBR_FLG
    FROM CCP_STG.CCP_MBRSHP_XREF)
    SELECT DISTINCT CLAIM_HDR.ICN_NUM AS ICN_NUM,
    CLAIM_HDR.SBCR_ID AS SBCR_ID,
    CLAIM_HDR.MBR_ID AS MBR_ID,
    CLAIM_HDR.MBR_FIRST_NAME AS MBR_FIRST_NAME,
    CLAIM_HDR.MBR_MI AS MBR_MI,
    CLAIM_HDR.MBR_LAST_NAME AS MBR_LAST_NAME,
    CLAIM_HDR.MBR_BIRTH_DATE AS MBR_BIRTH_DATE,
    CLAIM_HDR.GENDER_TYPE_CD AS GENDER_TYPE_CD,
    CLAIM_HDR.SBCR_RLTNSHP_TYPE_CD AS SBCR_RLTNSHP_TYPE_CD,
    CLAIM_HDR.SBCR_FIRST_NAME AS SBCR_FIRST_NAME,
    CLAIM_HDR.SBCR_MI AS SBCR_MI,
    CLAIM_HDR.SBCR_LAST_NAME AS SBCR_LAST_NAME,
    CLAIM_HDR.SBCR_ADDR_LINE_1 AS SBCR_ADDR_LINE_1,
    CLAIM_HDR.SBCR_ADDR_LINE2 AS SBCR_ADDR_LINE2,
    CLAIM_HDR.SBCR_ADDR_CITY AS SBCR_ADDR_CITY,
    CLAIM_HDR.SBCR_ADDR_STATE AS SBCR_ADDR_STATE,
    CLAIM_HDR.SBCR_ZIP_CD AS SBCR_ZIP_CD,
    CLAIM_HDR.PRVDR_NUM AS PRVDR_NUM,
    CLAIM_HDR.CLM_PRCSSD_DT AS CLM_PRCSSD_DT,
    CLAIM_HDR.CLM_TYPE_CLASS_CD AS CLM_TYPE_CLASS_CD,
    CLAIM_HDR.AUTHO_NUM AS AUTHO_NUM,
    CLAIM_HDR.TOT_BILLED_AMT AS TOT_BILLED_AMT,
    CLAIM_HDR.HCFA_DRG_TYPE_CD AS HCFA_DRG_TYPE_CD,
    CLAIM_HDR.FCLTY_ADMIT_DT AS FCLTY_ADMIT_DT,
    CLAIM_HDR.ADMIT_TYPE AS ADMIT_TYPE,
    CLAIM_HDR.DSCHRG_STATUS_CD AS DSCHRG_STATUS_CD,
    CLAIM_HDR.FILE_BILLING_NPI AS FILE_BILLING_NPI,
    CLAIM_HDR.CLAIM_LOCATION_CD AS CLAIM_LOCATION_CD,
    CLAIM_HDR.CLM_RELATED_ICN_1 AS CLM_RELATED_ICN_1,
    CLAIM_HDR.SUBSCR_INSGRP_NM,
    CLAIM_HDR.CAC,
    CLAIM_HDR.PRVDR_PTNT_ACC_ID,
    CLAIM_HDR.BILL_TYPE,
    CLAIM_DTL.FIRST_SRVC_DT AS FIRST_SRVC_DT,
    CLAIM_DTL.LAST_SRVC_DT AS LAST_SRVC_DT,
    CLAIM_DTL.PLC_OF_SRVC_CD AS PLC_OF_SRVC_CD,
    PROV.PROV_LST_NM AS BILL_PROV_LST_NM,
    PROV.PROV_FST_NM AS BILL_PROV_FST_NM,
    PROV.PROV_MD_NM AS BILL_PROV_MID_NM,
    PROV.PROV_BILL_ADR1 AS BILL_PROV_ADDR1,
    PROV.PROV_BILL_CITY AS BILL_PROV_CITY,
    PROV.PROV_BILL_STATE AS BILL_PROV_STATE,
    PROV.PROV_BILL_ZIP AS BILL_PROV_ZIP,
    PROV.PROV_SEC_ID AS BILL_PROV_EIN,
    PROV.PROV_ID AS SERV_FAC_ID    ,
    PROV.PROV_ADR1 AS SERV_FAC_ADDR1          ,
    PROV.PROV_CITY AS SERV_FAC_CITY ,
    PROV.PROV_STATE AS SERV_FAC_STATE          ,
    PROV.PROV_ZIP AS     SERV_FAC_ZIP  ,
    CHK_PAYMNT.CLM_PMT_PAYEE_ADDR_LINE_1,
    CHK_PAYMNT.CLM_PMT_PAYEE_ADDR_LINE_2,
    CHK_PAYMNT.CLM_PMT_PAYEE_CITY,
    CHK_PAYMNT.CLM_PMT_PAYEE_STATE_CD,
      CHK_PAYMNT.CLM_PMT_PAYEE_POSTAL_CD,
    CLAIM_HDR.CREAT_RUN_CYC_EXEC_SK
      FROM CLAIM_DTL,(select * FROM CCP_STG.CLM_DETAIL_PRESTG WHERE ACT_CD <>'D') CLM_DETAIL_PRESTG, CLAIM_HDR,CCP_STG.MBR_XREF,PROV,CCP_STG.CLM_PAYMNT_CLMEXT_PRESTG CLM_PAYMNT,CCP_STG.CLM_PAYMNT_CHKEXT_PRESTG CHK_PAYMNT
    WHERE    
    CLAIM_HDR.ICN_NUM = CLM_DETAIL_PRESTG.ICN_NUM
    AND       CLAIM_HDR.ICN_NUM = CLAIM_DTL.ICN_NUM
    AND CLAIM_HDR.ICN_NUM=CLM_PAYMNT.ICN_NUM(+)
    AND CLM_PAYMNT.CLM_PMT_CHCK_ACCT=CHK_PAYMNT.CLM_PMT_CHCK_ACCT
    AND CLM_PAYMNT.CLM_PMT_CHCK_NUM=CHK_PAYMNT.CLM_PMT_CHCK_NUM
    AND CLAIM_HDR.MBR_ENROLL_ID = MBR_XREF.MBR_ENROLLL_ID
    AND CLM_DETAIL_PRESTG.FIRST_SRVC_DT >= 20110101
    AND MBR_XREF.NEW_MBR_FLG = 'Y'
    AND PROV.PROV_ID(+)=SUBSTR(CLAIM_HDR.PRVDR_NUM,6)
    AND MOD(SUBSTR(CLAIM_HDR.ICN_NUM,14,2),2)=0
    UNION ALL
    SELECT DISTINCT CLAIM_HDR.ICN_NUM AS ICN_NUM,
    CLAIM_HDR.SBCR_ID AS SBCR_ID,
    CLAIM_HDR.MBR_ID AS MBR_ID,
    CLAIM_HDR.MBR_FIRST_NAME AS MBR_FIRST_NAME,
    CLAIM_HDR.MBR_MI AS MBR_MI,
    CLAIM_HDR.MBR_LAST_NAME AS MBR_LAST_NAME,
    CLAIM_HDR.MBR_BIRTH_DATE AS MBR_BIRTH_DATE,
    CLAIM_HDR.GENDER_TYPE_CD AS GENDER_TYPE_CD,
    CLAIM_HDR.SBCR_RLTNSHP_TYPE_CD AS SBCR_RLTNSHP_TYPE_CD,
    CLAIM_HDR.SBCR_FIRST_NAME AS SBCR_FIRST_NAME,
    CLAIM_HDR.SBCR_MI AS SBCR_MI,
    CLAIM_HDR.SBCR_LAST_NAME AS SBCR_LAST_NAME,
    CLAIM_HDR.SBCR_ADDR_LINE_1 AS SBCR_ADDR_LINE_1,
    CLAIM_HDR.SBCR_ADDR_LINE2 AS SBCR_ADDR_LINE2,
    CLAIM_HDR.SBCR_ADDR_CITY AS SBCR_ADDR_CITY,
    CLAIM_HDR.SBCR_ADDR_STATE AS SBCR_ADDR_STATE,
    CLAIM_HDR.SBCR_ZIP_CD AS SBCR_ZIP_CD,
    CLAIM_HDR.PRVDR_NUM AS PRVDR_NUM,
    CLAIM_HDR.CLM_PRCSSD_DT AS CLM_PRCSSD_DT,
    CLAIM_HDR.CLM_TYPE_CLASS_CD AS CLM_TYPE_CLASS_CD,
    CLAIM_HDR.AUTHO_NUM AS AUTHO_NUM,
    CLAIM_HDR.TOT_BILLED_AMT AS TOT_BILLED_AMT,
    CLAIM_HDR.HCFA_DRG_TYPE_CD AS HCFA_DRG_TYPE_CD,
    CLAIM_HDR.FCLTY_ADMIT_DT AS FCLTY_ADMIT_DT,
    CLAIM_HDR.ADMIT_TYPE AS ADMIT_TYPE,
    CLAIM_HDR.DSCHRG_STATUS_CD AS DSCHRG_STATUS_CD,
    CLAIM_HDR.FILE_BILLING_NPI AS FILE_BILLING_NPI,
    CLAIM_HDR.CLAIM_LOCATION_CD AS CLAIM_LOCATION_CD,
    CLAIM_HDR.CLM_RELATED_ICN_1 AS CLM_RELATED_ICN_1,
    CLAIM_HDR.SUBSCR_INSGRP_NM,
    CLAIM_HDR.CAC,
    CLAIM_HDR.PRVDR_PTNT_ACC_ID,
    CLAIM_HDR.BILL_TYPE,
    CLAIM_DTL.FIRST_SRVC_DT AS FIRST_SRVC_DT,
    CLAIM_DTL.LAST_SRVC_DT AS LAST_SRVC_DT,
    CLAIM_DTL.PLC_OF_SRVC_CD AS PLC_OF_SRVC_CD,
    PROV.PROV_LST_NM AS BILL_PROV_LST_NM,
    PROV.PROV_FST_NM AS BILL_PROV_FST_NM,
    PROV.PROV_MD_NM AS BILL_PROV_MID_NM,
    PROV.PROV_BILL_ADR1 AS BILL_PROV_ADDR1,
    PROV.PROV_BILL_CITY AS BILL_PROV_CITY,
    PROV.PROV_BILL_STATE AS BILL_PROV_STATE,
    PROV.PROV_BILL_ZIP AS BILL_PROV_ZIP,
    PROV.PROV_SEC_ID AS BILL_PROV_EIN,
    PROV.PROV_ID AS SERV_FAC_ID    ,
    PROV.PROV_ADR1 AS SERV_FAC_ADDR1          ,
    PROV.PROV_CITY AS SERV_FAC_CITY ,
    PROV.PROV_STATE AS SERV_FAC_STATE          ,
    PROV.PROV_ZIP AS     SERV_FAC_ZIP  ,
    CHK_PAYMNT.CLM_PMT_PAYEE_ADDR_LINE_1,
    CHK_PAYMNT.CLM_PMT_PAYEE_ADDR_LINE_2,
    CHK_PAYMNT.CLM_PMT_PAYEE_CITY,
    CHK_PAYMNT.CLM_PMT_PAYEE_STATE_CD,
    CHK_PAYMNT.CLM_PMT_PAYEE_POSTAL_CD,
    CLAIM_HDR.CREAT_RUN_CYC_EXEC_SK  
      FROM CLAIM_DTL, CLAIM_HDR,MBR_XREF,PROV,CCP_STG.CLM_PAYMNT_CLMEXT_PRESTG CLM_PAYMNT,CCP_STG.CLM_PAYMNT_CHKEXT_PRESTG CHK_PAYMNT
    WHERE CLAIM_HDR.ICN_NUM = CLAIM_DTL.ICN_NUM
    AND CLAIM_HDR.ICN_NUM=CLM_PAYMNT.ICN_NUM(+)
    AND CLM_PAYMNT.CLM_PMT_CHCK_ACCT=CHK_PAYMNT.CLM_PMT_CHCK_ACCT
    AND CLM_PAYMNT.CLM_PMT_CHCK_NUM=CHK_PAYMNT.CLM_PMT_CHCK_NUM
    AND CLAIM_HDR.MBR_ENROLL_ID = MBR_XREF.MBR_ENROLLL_ID
    -- AND TRUNC(CLAIM_HDR.PRESTG_INSRT_DT) = TRUNC(SYSDATE)
    AND CLAIM_HDR.CREAT_RUN_CYC_EXEC_SK = 123638.000000000000000
    AND MBR_XREF.NEW_MBR_FLG = 'N'
    AND PROV.PROV_ID(+)=SUBSTR(CLAIM_HDR.PRVDR_NUM,6)
    AND MOD(SUBSTR(CLAIM_HDR.ICN_NUM,14,2),2)=0;

  • How to execute a update query when the particular date changes

    hi all,
    i am using date base 11.1.0.6.0,
    i am trying a small update query it should fire when particular date changes in year.
    i think for trigger but i didn't get how to execute it.
    Regards,
    Pavan

    Hi, Pavan,
    Use dbms_scheduler to run a procedure at a given time (or at repeatedly, at given times).
    A trigger is good for re-acting to certain actions in the database, someone INSERTing a row in a given table, for example. Nothing will necessarily be happening when you want your procedure to run, so a trigger is not good in this case.

  • Query to search between two specific dates and time period

    Hi,
    Need a query to search between two particular dates and time period
    Like i want to search table having one date field .
    Suppose the date range is '01-JUL-06' and '01-AUG-06' and time frame
    is 23:00:00 to 08:00:00
    i.e i want to search between dates 01 july to 01 aug and also within the time frame i.e 23:00 to 08:00 hrs only

    The general principle is
    SELECT * FROM your_table
    WHERE some_date BEWTEEN to_date('01-JUL-06') and to_date('01-AUG-06' )+0.99999
    AND  ( some_date <= trunc(some_date)+8/24
               OR  some_date >= trunc(some_date)+23/24 )
    /Cheers, APC

  • How to fetch records between two seq uence numbers?

    We have thousands of records with seq uence numbers in the oracle database, we need to retrieve a number of records between two seq uence numbers, i.e. to retrieve records between 100 and 200 seq uence numbers. Could some one help me to find a query to fetch records.
    I'll be waiting for your response..
    Edited by: sumant on Jul 27, 2010 12:42 PM

    Is this is what you are looking for?
    SQL> create table tab1 (id number);
    Table created.
    SQL> insert into tab1 values (1);
    1 row created.
    SQL> insert into tab1 values (2);
    1 row created.
    SQL> insert into tab1 values (3);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from tab1;
            ID
             1
             2
             3
    SQL> select round(dbms_random.value(max(id)+1,max(id)+50)) random_number
      2  from tab1;
    RANDOM_NUMBER
               43
    SQL> select round(dbms_random.value(max(id)+1,max(id)+50)) random_number
      2  from tab1;
    RANDOM_NUMBER
               39
    SQL> select round(dbms_random.value(max(id)+1,max(id)+50)) random_number
      2  from tab1;
    RANDOM_NUMBER
               13 This will generate a random number that will be greater then the maximum value in the table and lower then the maxvalue + 50. Having the range starting from maxvalue in the table you will never get a number generated which already exists in the table.
    As you see in the above number genrated they are all between 4 and 53.
    If you want to increase the range from where the number are generated just increase the value 50 that I used in the query.

Maybe you are looking for

  • Multiple people checked out a story at the same time

    Had a strange  incident today where two incopy users had story checked out at the same time. I wouldn't have believed it if I hadn't seen it for myself. I checked the links, they were going to the same place. One user lost his changes when both check

  • How can you set up your iphone 4s to show 2 seperate email address but that are on the same domain

    I have 2 email address linked to me on Outlook. one is a personal one for me and one is a group email address but both on the same domain. I have my own inbox set up on my iphone and i have tried to set up the group email address on my iphone, but be

  • Multiple iPhoto libraries on my ext hard drive back up

    Hi I have a problem with multiple iPhoto libraries on my ext hard drive back up  They are different sizes and large 120gb  Is there any way I can rationalise the libraries without the risk of losing data? My iPhoto library on the Mac appears to be co

  • Static Method to calculate ' Average '.

    Hi I am wondering which one is preferred?  Static or Instance methods for calculating 'average' (e.g average sales). My class lcl_company is having attributes name and sales. which represents name = name of the company, sales = total sales of one com

  • To make a table available for maintanance(very urgent Pls!)

    Hi , My requirement is .I need to create a Z custom table to which  some default values are to be maintained. My question is... 1) what is the delivery class that i need to give while creating that Ztable? 2) How to make it open for maintanence? Do i