SQL query to fetch WIP jobs agains a customer

Hi All,
Can anyone please help me with a SQL query to fetch WIP jobs agains a customer.
Regards,
Shruti

If you are using ATO functionality and if you are reserving sales orders to work orders, you can link them as follows
Using customer name, identify the open sales order headers and lines.
For each line, query reservations (mtl_reservations) using demand id fields.
For those reservations where supply = wip job, use the supply id fields and get wip_entity_id.
Using wip_entity_id, get wip_entity_name(job#) from wip_entities table.
Once a job is completed, this link is lost.
Sandeep Gandhi

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

  • How will write SQL query to fetch data from  each Sub-partition..

    Hi All,
    Anyone does have any idea about How to write SQL query to fetch data from Sub-partition.
    Actually i have one table having composite paritition(Range+list)
    Now if i want to fetch data from main partition(Range) the query will be
    SELECT * FROM emp PARTITION(q1_2005);
    Now i want to fetch data at sub-partition level(List) .But i am not able to get any SQL query for that.
    Pls help me to sort out.
    Thanks in Advance.
    Anwar

    SELECT * FROM emp SUBPARTITION(sp1);

  • Sql query to find the balances for a customer account wise.

    Hi,
    Could someone help me with the sql query to find the balances for each customer account wise. This is need to generate the report.
    presently we are using this query, but the output doesnot return the expected result.
    SELECT sum(nvl(ps.acctd_amount_due_remaining,0)) "Balance"
    FROM      ra_cust_trx_line_gl_dist_all gld,
              gl_code_combinations c,
              ar_payment_schedules_all ps,
              RA_CUSTOMER_TRX_ALL rat,
              ra_customers rc
    WHERE      c.CHART_OF_ACCOUNTS_ID = 101
    and gld.code_combination_id = c.code_combination_id
         and rat.CUSTOMER_TRX_ID=gld.CUSTOMER_TRX_ID
         and rat.CUSTOMER_TRX_ID=ps.CUSTOMER_TRX_ID
    and ps.customer_id=rc.customer_id
         and ps.status='OP'
         and ps.gl_date <= :PDATE
         and ps.org_id=:PORGID
         and ps.class in ('GUAR','INV','DM','DEP')
    and c.SEGMENT4=:Account_id
    and ps.customer_id=:Customer_id
    Thanks in advance.
    Kalyan.

    Can someone help us with this.

  • SQL query to fetch Online Payslip Details

    Hi All,
    First of all "Happy Diwali" to you all and sorry for asking too much. Actually I need to develope an SQL query which will fetch all the details that appears in online payslip(employee self service) including employee details, earning and deduction elements their value, TAX deducted, absence details etc. And the details should match exactally to our online payslip details.
    I am sure many of you have come across this requirement and have developed this already. If you still have that query could you please pass it to me. I know expecting a readymade sql query would be too much and therefore just let me know all the tables I need use for this so that I can start writting query by my own. Actually any help in this regard will be much appreciated.
    P.S. We are still using 11i :-(
    Thank you all once again,
    Avinash

    Hi All,
    Thank you all for your help on this. The forum was really helpful to get answer of my question. I have almost got answer to all my question. Hence marking this "Answered" :-) I have prepared some sql which fetches the information from PAY_ACTION_INFORMATION for Australia legislation and would like to share it with you all so that you can utalize it if needed.
    ------------ For Employee Details ---------------------------------------
    select pai.action_information1 "Employee"
    ,pai.action_information18 "Employer Name"
    ,pai.action_information10 "Employee Number"
    ,pai.action_information19 "Position"
    ,pai.action_information14 "Assignment Number"
    ,pai.action_information17 "Job"
    ,pai.action_information7 "Grade Step"
    from apps.pay_action_information pai
    where 1 = 1
    and pai.action_information_category = 'EMPLOYEE DETAILS'
    and action_context_id = &action_context_id
    ------------ for IBN Number ----------------------------------------------
    select pai.action_information21 "Employer ABN"
    from apps.pay_action_information pai
    where 1 = 1
    and pai.action_information_category = 'AU EMPLOYEE DETAILS'
    and action_context_id = &action_context_id
    ------- For Balances ------------------------------------------------------
    select pai.action_information1 "Description"
    ,pai.action_information4 "YTD"
    ,pai.action_information5 "This Pay"
    from apps.pay_action_information pai
    where 1 = 1
    and pai.action_information_category = 'APAC BALANCES'
    and action_context_id = &action_context_id
    --------- Taxable Earning ------------------------------
    select pai.action_information1 "Description"
    ,pai.action_information9 "Rate"
    ,pai.action_information5 "This Pay"
    from apps.pay_action_information pai
    where 1 = 1
    and pai.action_information_category = 'APAC ELEMENTS'
    and action_information4 = 'Taxable Earnings'
    and action_context_id = &action_context_id
    ----------- Pre Tax Deduction -------------
    select pai.action_information1 "Description"
    ,pai.action_information5 "This Pay"
    from apps.pay_action_information pai
    where 1 = 1
    and pai.action_information_category = 'APAC ELEMENTS'
    and action_information4 = 'Pre Tax Deductions'
    and action_context_id = &action_context_id
    --------------- Non Taxable Earnings -----------
    select pai.action_information1 "Description"
    ,pai.action_information9 "Rate"
    ,pai.action_information5 "This Pay"
    from apps.pay_action_information pai
    where 1 = 1
    and pai.action_information_category = 'APAC ELEMENTS'
    and action_information4 = 'Non Taxable Earnings'
    and action_context_id = &action_context_id
    --------- for Tax Deductions ----------------------
    select pai.action_information1 "Description"
    ,pai.action_information5 "This Pay"
    from apps.pay_action_information pai
    where 1 = 1
    and pai.action_information_category = 'APAC ELEMENTS'
    and action_information4 = 'Tax Deductions'
    and action_context_id = &action_context_id
    ---------- Post Tax Deductions -----------------
    select pai.action_information1 "Description"
    ,pai.action_information5 "This Pay"
    from apps.pay_action_information pai
    where 1 = 1
    and pai.action_information_category = 'APAC ELEMENTS'
    and action_information4 = 'Post Tax Deductions'
    and action_context_id = &action_context_id
    --------- Employer Superannuation Contributions ----------------------
    select pai.action_information1 "Superannuation Fund Name"
    ,pai.action_information5 "This Pay"
    from apps.pay_action_information pai
    where 1 = 1
    and pai.action_information_category = 'APAC ELEMENTS'
    and action_information4 = 'Employer Superannuation Contributions'
    and action_context_id = &action_context_id
    ----------- Payments -----------------------------
    select pai.action_information18 "Payment Method"
    ,pai.action_information6 "Account Number"
    ,pai.action_information16 "Payment Amount"
    from apps.pay_action_information pai
    where 1 = 1
    and pai.action_information_category = 'EMPLOYEE NET PAY DISTRIBUTION'
    and action_context_id = &action_context_id
    ------------- Other Pay Advice Information ------------
    select pai.action_information14 "Description"
    ,pai.action_information6 "Value"
    from apps.pay_action_information pai
    where 1 = 1
    and pai.action_information_category = 'EMPLOYEE OTHER INFORMATION'
    and action_information2 = 'ELEMENT'
    and action_context_id = &action_context_id
    -------------------- Other Balance Information -----------
    select pai.action_information14 "Description"
    ,pai.action_information6 "Value"
    from apps.pay_action_information pai
    where 1 = 1
    and pai.action_information_category = 'EMPLOYEE OTHER INFORMATION'
    and action_information2 = 'BALANCE'
    and action_context_id = &action_context_id
    ------------------- Pay Period and Salary ------------
    select pai.action_information28 "Annual Salary"
    from apps.pay_action_information pai
    where 1 = 1
    and pai.action_information_category = 'EMPLOYEE DETAILS'
    --and action_information2 = 'BALANCE'
    and action_context_id = &action_context_id
    --------------- Annual Leave Information ------------
    select pai.action_information1 "Name"
    ,decode(pai.action_information5,'D','Day','H','Hours') "Unit"
    ,pai.action_information4 "Balance"
    from apps.pay_action_information pai
    where 1 = 1
    and pai.action_information_category = 'APAC ACCRUALS'
    and action_context_id = &action_context_id
    ----------- Message to Employee -----------
    select pai.action_information6 "Message to Employee"
    from apps.pay_action_information pai
    where 1 = 1
    and action_information_category = 'EMPLOYEE OTHER INFORMATION'
    and action_information2 = 'MESG'
    and action_context_id = &action_context_id
    ---------------- Leave Taken -------------
    select pai.action_information2 "Name"
    ,pai.action_information4 "Start Date"
    ,pai.action_information5 "End Date"
    ,pai.action_information6 "Amount Taken"
    ,pai.action_information8 "This Pay"
    from apps.pay_action_information pai
    where 1 = 1
    and action_information_category = 'APAC ABSENCES'
    and action_context_id = &action_context_id
    Thanks,
    Avinash

  • SQL query to fetch approximately 9000 rows

    Hi,
    I am using the following SQL query in a java class. Using JDBC to connect to an Oracle database using JRUN app server connection pooling.
    SELECT PT.ACCOUNT_NUMBER,PAYMENT_REF_ID, TO_CHAR (PT.DATE_CREATED, 'MM/DD/YYYY'),
    PT.AMOUNT_PAID, DECODE(STATUS_VALUE,'Cancelled','Canceled',STATUS_VALUE)
    FROM EPAY_PAYMENT_TRANSACTIONS PT, EPAY_STATUS_LOOKUP SL
    WHERE
    PT.CLIENT_NAME = 'someclientname'
    AND TO_CHAR(DATE_PAYMENT_SCHEDULED,'MM/DD/YYYY') = '08/28/2006'
    AND PT.PAYMENT_STATUS = SL.STATUS_CODE
    ORDER BY PT.DATE_CREATED DESC
    EPAY_PAYMENT_TRANSACTIONS is a huge table consisting of thousands of rows. There are 4 indexes defined on this table but not on the columns used in the join condition of the query.
    EPAY_STATUS_LOOKUP is a much smaller table mainly used for lookup consisting of some 100 rows.
    The above query fetches approx 9000 records and takes a very long time to execute. Is there any way it can be optimized or we can change some attributes on the tables involved for speeding up the query?
    Thanks in advance,
    Nisha.

    So the task is to avoid FTS on EPAY_PAYMENT_TRANSACTIONSWell, maybe...
    But I believe that we have yet to hear more details about data distribution, execution plans and so on.
    Because it all depends...
    Consider simple testcase:
    SQL> select * from v$version where rownum = 1;
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
    SQL> -- Create "small" table
    SQL>
    SQL>  create table build_t as
      2   select rownum x,
      3          rpad('*', 200, '*') padding
      4     from dual
      5  connect by level <= 100;
    Table created.
    SQL> -- Create "large" table - initially, add 9000 rows which satisfy join criteria
    SQL>
    SQL>  create table probe_t as
      2   select mod(rownum - 1, 100) + 1 x,
      3          dbms_random.value y,
      4          rpad('*', 200, '*') padding
      5     from dual
      6  connect by level <= 9000;
    Table created.
    SQL> -- Now, add some extra rows to large table - "thousands of rows"
    SQL>
    SQL>  insert into probe_t
      2   select rownum + 100,
      3          0,
      4          rpad('*', 200, '*') padding
      5     from dual
      6  connect by level <= 100000;
    100000 rows created.
    SQL> exec dbms_stats.gather_table_stats(user, 'BUILD_T')
    PL/SQL procedure successfully completed.
    SQL> exec dbms_stats.gather_table_stats(user, 'PROBE_T')
    PL/SQL procedure successfully completed.
    SQL> -- Ok, let's measure ...
    SQL>
    SQL> set autot traceonly
    SQL>
    SQL> select a.*, b.*
      2    from build_t a,
      3         probe_t b
      4   where a.x = b.x
      5   order by b.y;
    9000 rows selected.
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=1387 Card=109 Bytes=45017)
       1    0   SORT (ORDER BY) (Cost=1387 Card=109 Bytes=45017)
       2    1     HASH JOIN (Cost=1386 Card=109 Bytes=45017)
       3    2       TABLE ACCESS (FULL) OF 'BUILD_T' (Cost=5 Card=100 Bytes=20400)
       4    2       TABLE ACCESS (FULL) OF 'PROBE_T' (Cost=1355 Card=109000 Bytes=22781000)
    Statistics
              0  recursive calls
              0  db block gets
           3280  consistent gets
              0  physical reads
              0  redo size
         360756  bytes sent via SQL*Net to client
           7096  bytes received via SQL*Net from client
            601  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
           9000  rows processedOn my server, this query finished in less that second and took 3280 LIO to complete.
    Now, which index did you mean to build? I guess it's and index on join column, isn't it?
    If so - let's build it and measure again:
    SQL> create index idx_probe_t on probe_t(x);
    Index created.
    SQL> select /*+ ORDERED USE_NL(a b) */
      2         a.*, b.*
      3    from build_t a,
      4         probe_t b
      5   where a.x = b.x
      6   order by b.y;
    9000 rows selected.
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=211 Card=109 Bytes=45017)
       1    0   SORT (ORDER BY) (Cost=211 Card=109 Bytes=45017)
       2    1     TABLE ACCESS (BY INDEX ROWID) OF 'PROBE_T' (Cost=3 Card=1 Bytes=209)
       3    2       NESTED LOOPS (Cost=210 Card=109 Bytes=45017)
       4    3         TABLE ACCESS (FULL) OF 'BUILD_T' (Cost=5 Card=100 Bytes=20400)
       5    3         INDEX (RANGE SCAN) OF 'IDX_PROBE_T' (NON-UNIQUE) (Cost=2 Card=1)
    Statistics
              0  recursive calls
              0  db block gets
           9124  consistent gets
             21  physical reads
              0  redo size
         360756  bytes sent via SQL*Net to client
           7096  bytes received via SQL*Net from client
            601  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
           9000  rows processedLook at this - 9124 consistent gets, almost three times larger than in case of hash join.
    Full table scan is not something to be avoided at all cost.
    Indexing - sometimes it is good,
    sometimes it's just useless,
    sometimes it only makes things worse...
    It all depends on underlying data distribution. That's why I asked user527580 to tell us more.
    Kind regards.

  • SQL query to fetch the catalog category for a PLM item

    Hi All,
    Can anyone help me with a sql query of how we can fetch the catalog category for a PLM item.
    Regards,
    Shruti

    Hi,
    You could monitor the SMSProv.log when you check the category of an application. It shows that SQL query the SCCM provider used is related to function fn_ListCategoryInstances.
    Best Regards,
    Joyce

  • Sql query to fetch data based on date conditons

    Hi All,
    We have to schedule a script that runs at 1:00 AM from Monday to Friday.
    The script will run a  sql query  ,that will fetch the data from sql database 2008 based on the below conditions.
    Case 1: If date = current Date then retrieve the data of the previous Date.
    Case 2: If date = Monday then retrieve the entries of Friday ,Saturday and Sunday.
    Please help us on how we can achieve this.
    Thanks

    Hi,
    Are you asking about Patrick's
    solution?
    If so I highly recommend NOT to use this solution. PLease read LMU92's
    and
    Visakh16's responses.
    Why not to use it?
    1. This solution is not deterministic!
    A deterministic algorithm is an algorithm which, given a particular input, will always produce the same output. This solution give different values for different setting! It is depending for example on "SET LANGUAGE" value
    As mentioned above if you try to use any other languge then English then this query will not work since you will never get the value "Sunday"
    2. Moreover! Even if you are using "SET LANGUAGE 'English'" then this
    solution depend on "SET DATEFIRST" and only take into consideration that the value can be 1 or 7, using any other value you will get that @weekendDateMod is null!
    What can you use?
    let's test some value first to get the solution yourself. We know that we don't care about "SET LANGUAGE" since I will not use any language dependency but we need to examine "SET DATEFIRST". Try to change the value from 1 to 7 and check
    the value of this query
    SET DATEFIRST 1 -- Change this value from 1 to 7!
    DECLARE @Sunday DATE = '2014-08-03' -- This is Sunday
    DECLARE @Munday DATE = '2014-08-04' -- This is Munday
    SELECT DATEPART(DW,@Sunday),DATEPART(DW,@Munday), @@DATEFIRST
    Can you see the behavior ?
    The results are hidden here (select the text and you will see them)
    DATEFIRST___Sunday_______Monday
    1___________7___________1
    2___________6___________7
    3___________5___________6
    4___________4___________5
    5___________3___________4
    6___________2___________3
    7___________1___________2
    assuming you did the exercise above yourself, then  you can now think now what is the filter that you need...
    You can use a filter on those two parameters together using "where DATEPART... and @@DATEFIRST...) or using one combine check. Can you think how?
    Notice that this value is always 2 on Monday! Regarding our setting
    (DATEPART(DW,@CurrentDate) + @@DATEFIRST) % 7
    Please Don't Go Down Before YOu Understand!
    Now we can go to the solution
    * I really hope that you read all and did the small exercise yourself! You can not become a developer by copy answers, and this is the reason that from the start I only gave you tha way and not the final query!
    DECLARE @CurrentDate DATE = '2007-08-20' -- This is only for testing since you should use the function GETDATE() instead
    DECLARE @MinDateToFilter DATE
    SET @MinDateToFilter = CASE
    WHEN ((DATEPART(DW,@CurrentDate) + @@DATEFIRST) % 7) = 2 THEN DATEADD(DAY,-4,@CurrentDate)
    ELSE DATEADD(DAY,-1,@CurrentDate)
    END
    SELECT *
    FROM sales.salesOrderHeader
    WHERE orderDate > @MinDateToFilter
    I hope this was useful :-)
    [Personal Site] [Blog] [Facebook]

  • SQL Query to Fetch 500 Rows at once

    Hi,
      Due to performance issue of the SQL query takes lot of time to execute. I tried modifying the code as mentioned below but it is not working to fetch when search is implemented. Actually data is more than 1 Million Records so it takes lot of time to query the data.
    SELECT DISTINCT
    IMV.*,
      nvl(imv.party_name,imv.bill_to_name) "Bill To Name",
      Imv.Ship_To_City "Reseller City",
      Imv.Ship_To_State "Reseller State",
      Edb2_Global.Country_Name_Theater(Imv.Ship_To_Country ,'COUNTRY') "Reseller Country",
      Edb2_Global.Country_Name_Theater(Imv.Ship_To_Country ,'THEATER') "Reseller Theater",
      Cl.City "Customer City",
      Cl.State "Customer State",
      EDB2_GLOBAL.COUNTRY_NAME_THEATER(CL.COUNTRY,'COUNTRY') "Customer Country",
      EDB2_GLOBAL.COUNTRY_NAME_THEATER(CL.COUNTRY,'THEATER') "Customer Theater"
    FROM IB_SUPPORT_CONTRACTS_MV IMV,
      customer_products cp,
      customer_locations cl
    WHERE
    UPPER(TRIM(IMV.SERIAL_NUMBER)) = UPPER(TRIM(CP.PRODUCT_SERIAL_NUMBER(+) ) )
    AND CP.LOCATION_ID                     = CL.LOCATION_ID(+)
    AND ROWNUM <= 501
    Please suggest me how to improve the performance of the query.
    Thanks
    Sudhir

    Hi,
    As mentioned already, this condition is really hurting performance:
    UPPER(TRIM(IMV.SERIAL_NUMBER)) = UPPER(TRIM(CP.PRODUCT_SERIAL_NUMBER(+) ) )
    Could you trim and capitalize the serial numbers before storing them?  Do you really need to remember exactly how the serial numbers were entered?  If you really do, then store it in one column, and store UPPER (TRIM (serial_number)) in a different column.  Starting in Oracle 11, this could be a virtual column; in any version (7 or higher), it could be maintained by a trigger.  Failing that, create a function-based index on UPPER (TRIM (serial_number)).

  • Sql query to fetch session id

    Hi,
    I am to trying to fetch session id of a previously submitted process of a search button......so that i can display the search results in a different page.....so is there any sql query or pl/sql procedure to fetch the session id.

    >
    Please update your forum profile with a real handle instead of "968337".
    I am to trying to fetch session id of a previously submitted process of a search button......It's not all clear what you are trying to do. The documentation describes an APEX session and its ID thus:
    >
    A session is a logical construct that establishes persistence (or stateful behavior) across page views. Each session is assigned a unique identifier. The Application Express engine uses this identifier (or session ID) to store and retrieve an application's working set of data (or session state) before and after each page view.
    >
    This means that each page view and page submission does not have its own session ID, but uses the session ID established when the user's current session began (which is usually through logon and authentication).
    Given this definition of session and session ID, are you therefore referring to the ID of some previous user session in which a page was submitted by a search button? Or some private meaning that you have yet to fully explain?
    so that i can display the search results in a different page.....so is there any sql query or pl/sql procedure to fetch the session id.The session ID of the current session is available using the the built-in substitution string<tt>APP_SESSION</tt> built-in substitution string.
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    Following the guidelines in these documents will also help to explain the problem in much more detail and with sufficient background for it to be understood:
    <li>+How to ask questions+
    <li>+{message:id=9360002}+
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.

  • SQL Query to fetch a specific field in xml

    Hi,
    Below is my sample Xml file.
    <?xml version = "1.0" encoding = "UTF-8"?>
    <methodCall xmlns = "http://www.tibco.com/schemas/CS4_new1/Schema.xsd" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://www.tibco.com/schemas/CS4_new1/Schema.xsd Schema_new.xsd">
    <methodName>rBatchFile </methodName>
    <params>
    <param>
    <value>
    <struct>
    <member>
    <name>filename</name>
         <value>
         D:\test.txt
         </value>
    </member>
    <member>
    <name>batchId</name>
    <value>
         L1
    </value>
    </member>
    </struct>
    </value>
    </param>
    </methodName>
    </methodCall>
    I want to query a "value" field based on the "name" field. I tried with the following query which didnt work.
    SELECT a.extract('//value/text()' , 'xmlns:="http://www.tibco.com/schemas/CS4_new1/Schema.xsd" ')
    FROM ( SELECT t.customerinfo.extract('//member[name="filename"]','xmlns:="http://www.tibco.com/schemas/CS4_new1/Schema.xsd" ')
    FROM cust_order t ) a;
    Please do provide the SQL query ASAP.

    with tab as (
    select xmltype('<?xml version = "1.0" encoding = "UTF-8"?>
    <methodCall xmlns = "http://www.tibco.com/schemas/CS4_new1/Schema.xsd" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://www.tibco.com/schemas/CS4_new1/Schema.xsd Schema_new.xsd">
    <methodName>rBatchFile </methodName><params>
    <param>
    <value>
    <struct>
    <member>
    <name>filename</name>
    <value>
    D:\test.txt
    </value>
    </member>
    <member>
    <name>batchId</name>
    <value>
    L1
    </value>
    </member>
    </struct>
    </value>
    </param>
    </params>
    </methodCall>
    ') a from dual
    --end of sample data
    SELECT
      extractvalue(column_value,'/member/name') name,
      extractvalue(column_value,'/member/value') value
    from tab t,xmltable('xmlns = "http://www.tibco.com/schemas/CS4_new1/Schema.xsd" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://www.tibco.com/schemas/CS4_new1/Schema.xsd Schema_new.xsd"','for $i in //member return $i' passing t.a)An example...but i tweaked the xml...check the xml namespace once before executing...
    without adding the namespaces...code will be like...
    with tab as (
    select xmltype('<?xml version = "1.0" encoding = "UTF-8"?>
    <methodCall >
    <methodName>rBatchFile </methodName><params>
    <param>
    <value>
    <struct>
    <member>
    <name>filename</name>
    <value>
    D:\test.txt
    </value>
    </member>
    <member>
    <name>batchId</name>
    <value>
    L1
    </value>
    </member>
    </struct>
    </value>
    </param>
    </params>
    </methodCall>
    ') a from dual
    --end of sample data
    SELECT
      extractvalue(column_value,'/member/name') name,
      extractvalue(column_value,'/member/value') value
    from tab t,xmltable('for $i in //member return $i' passing t.a)Ravi Kumar

  • SQL query to fetch as count manytimes

    Hi All,
    greetings for the day.
    i am using 10g details herewith:
    Version
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
    PL/SQL Release 10.2.0.2.0 - Production,CORE 10.2.0.2.0 Production,TNS for 32-bit Windows: Version 10.2.0.2.0 - Production
    create table bsl_citi ( col_1 number primary key,
    col_2 varchar2(10) not null,
    col_3 number
    insert into bsl_citi values (1,'india',3);
    insert into bsl_citi values (2,'USA',2);
    insert into bsl_citi values (3,'USSR',1);
    insert into bsl_citi values (4,'NEPAL',0);
    insert into bsl_citi values (5,'NwYrk',2);
    commit;
    OUTPUT
    COL_1 COL_2 COL_3
    1 india 3
    2 USA 2
    3 USSR 1
    4 NEPAL 0
    5 NwYrk 2
    Expected Output
    COL_1 COL_2 COL_3
    1 india 3
    1 india 3
    1 india 3
    2 USA 2
    2 USA 2
    3 USSR 1
    5 NwYrk 2
    5 NwYrk 2
    (i.e., the number in COL_3 that many times should repeat)
    thanks in advance

    Can you please explain me your query
    SELECT *
    FROM (SELECT b.*,
    ROW_NUMBER () OVER (PARTITION BY col_1 ORDER BY col_1) r
    FROM bsl_citi b
    CONNECT BY 1 = 1 AND LEVEL <= col_3)
    WHERE r <= col_3
    in-line-view which consider the level inside the query. the value in the COL_3 less than or equal many times we have to fetch that was he wrote.
    i guess kiran will respond somewhat clear than this,
    thanks

  • Sql query to find backgorund jobs and their associated reports

    Hi Guys
    is there any possibility to find job (jobname) their scheduling and the corresponding reports with their variant via sql queries?
    Looking up the tables tbt-something only show %NEWSTEP for the INTREPORT value, so this isn´t clearifying at all.
    Maybe you could tell me the tables where the reports and their variants are saved.
    Cheers
    Fabi

    hi check this...
    go to the table TIBCO
    there you will find
    jobname
    jobgroup
    report name
    job status
    but there is no varient specification and
    %NEWSTEP is the report name

  • 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;

  • SQL query to fetch 2 rows in one

    Hi, following is sample data:
    COLLMETHID EEID XORDERID AMOUNT
    BREDM 3136 3435698 3000
    VISA 3136 3435698 7190
    BREDM 6607 3519115 1492
    BREDM 6614 3558451 1500
    VISA 6614 3558451 149
    BREDM 6616 3567631 2120
    VISA 6616 3567631 158
    BREDM 8356 3558864 899
    And I need this result:
    xorderid eeid coll1 coll2 sum_AMOUNT
    3435698 3136 BREDM VISA 10190
    3519115 6607 BREDM null 1492
    3558451 6614 BREDM VISA 2992
    please help me
    Amitesh
    Its very urgent. My project's UAT is blocking due to this bug.
    Amitesh

    this may help
    QL> With t As
      2  (
      3    Select 'BREDM' c1, 3136 eid , 3435698 Xid, 3000 amt From dual Union All
      4    Select 'VISA',     3136,    3435698,     7190     From dual Union All
      5    Select 'BREDM',    6607,    3519115,     1492     From dual Union All
      6    Select 'BREDM',    6614,    3558451,     1500     From dual Union All
      7    Select 'VISA',     6614,    3558451,     149      From dual Union All
      8    Select 'BREDM',    6616,    3567631,     2120     From dual Union All
      9    Select 'VISA',     6616,    3567631,     158      From dual Union All
    10    Select 'BREDM',    8356,    3558864,     899      From dual
    11  )
    12  Select Distinct
    13         eid,
    14         Xid,
    15         first_value(c1) over (Partition By eid, Xid Order By eid) "c1",
    16         last_value(c1) over (Partition By eid, Xid Order By eid) "c2" ,
    17         Sum (amt ) over (Partition By eid, Xid) "amt"
    18  From t;
           EID        XID c1    c2           amt
          6616    3567631 BREDM VISA        2278
          8356    3558864 BREDM BREDM        899
          6607    3519115 BREDM BREDM       1492
          6614    3558451 BREDM VISA        1649
          3136    3435698 BREDM VISA       10190
    OR
    SQL> With t As
      2  (
      3    Select 'BREDM' c1, 3136 eid , 3435698 Xid, 3000 amt From dual Union All
      4    Select 'VISA',     3136,    3435698,     7190     From dual Union All
      5    Select 'BREDM',    6607,    3519115,     1492     From dual Union All
      6    Select 'BREDM',    6614,    3558451,     1500     From dual Union All
      7    Select 'VISA',     6614,    3558451,     149      From dual Union All
      8    Select 'BREDM',    6616,    3567631,     2120     From dual Union All
      9    Select 'VISA',     6616,    3567631,     158      From dual Union All
    10    Select 'BREDM',    8356,    3558864,     899      From dual
    11  )
    12  Select Distinct
    13         eid,
    14         Xid,
    15         first_value(c1) over (Partition By eid, Xid Order By eid) "c1",
    16         Case When last_value(c1) over (Partition By eid, Xid Order By eid)
    17              = first_value(c1) over (Partition By eid, Xid Order By eid)
    18         Then Null
    19         Else last_value(c1) over (Partition By eid, Xid Order By eid)
    20         End "c2" ,
    21         Sum (amt ) over (Partition By eid, Xid) "amt"
    22  From t;
           EID        XID c1    c2           amt
          6616    3567631 BREDM VISA        2278
          6614    3558451 BREDM VISA        1649
          3136    3435698 BREDM VISA       10190
          8356    3558864 BREDM              899
          6607    3519115 BREDM             1492Message was edited by:
    Nicloei W

Maybe you are looking for

  • How to call a function module from the Web Template?

    Hi all, how can I call a function module from a BI 7.x web template and then show the result of the FM on the web template? Many thanks for your hints. Regards, Nils

  • Pages version is too old!

    I want to open a pages document.  It says my version for pages is 4. something.  And it is too old to open document.  When I go to the App store, it says it is already downloaded and purchased.  I tried putting it in trash and then downloading it aga

  • Scripting in Java 6: Passing parameters to a factory

    Dear forum members, Since recently I am enjoying the new scripting facilities of Java 6. I like the idea of having factory engines. But I am surprised that there is no (obvious) way to pass parameters to the engine. The class javax.script.ScriptEngin

  • I can't close a preview file - no red dot.

    No option in file. So I can't restart/shut down.  How do I get rid of this open file?

  • POSTING data http how to ...

    Hi i want to POST the data through the socket GET methods works fine as the follwing way , how can i do it by POST Socket tunnel = new Socket("Host", port); PrintWriter out = new PrintWriter( new BufferedWriter( new OutputStreamWriter(