Query For Finding Revised PO Amout in Purchasing in Each Revisions

Can anybody please tell me how
can i write a query for Extracting
individual PO amounts in each revisions of a
PO from PO_LINES_ARCHIEVE_ALL..
ie FOR Each revisions of a PO What was the total PO Amount
Regards
Binu

Hi Geoff,
You can use the ROW_NUMBER and CASE Functions to acheive this. Here with , i have give u a small idea with an ex:
Qry :
B.ItemCode,SUM(B.PO1)[PO1],SUM(B.POQty1)[POQty1],SUM(B.PO2)[PO2],SUM(B.POQty2)[POQty2] From
select Itemcode
CASE when Sno=1 Then DocNum End [PO1]
CASE When Sno=1 Then Qty End [POQty1]
CASE when Sno=2 Then DocNum End [PO2]
CASE When Sno=2 Then Qty End [POQty2]
From(
Row_Number() Over (Order By Opor.Docnum) [Sno], Opor.DocNum,POr1.ItemCode,sum(POr1.Quantity)[Qty] from OPOR join Por1 on Opor.DocEntry=por1.DocEntry
ItemCode='20002' group by oPor.DocNum,por1.ItemCode
A where A.Sno<=2)B Group By B.ItemCode
Result :-
ItemCode  PO1         POQty1           PO2            POQty2
20002       18            1.000000         19                10.000000
Thanks,
Karthikeyan.P

Similar Messages

  • Write a query for finding STDDEV for OLAP Cube

    Can anybody post a sample query which will find the standard deviation of sales for each month in the sample GLOBAL OLAP schema for Oracle 11g.
    The OLAP option automatically generates a set of relational views on cubes, dimensions, and hierarchies in Oracle 11g. So how can i write a query for finding the Standard deviation on these views.

    The easiest way to do this is to do this directly within the AW using a custom calculated measure. In AWM11g you can use the 11g custom measure wrapper to execute the STDDEV function:
    olap_dml_expression('function',data type)
    For example
    olap_dml_expression('STDDEV(cube_name, time_dimension_name)',number)
    You can then simply expose this calculated measure as another column in your SQL View and then there is no need to use the SQL equivalent. This means the calculation is performed inside the AW (which is as close to the source data as you can get) ensuring performance of the whole query remains high.
    If necessary you can take this a step further, if required, and wrap the STDDEV calculation within an OLAP DML program that would allow you to manipulate the status of time within the calculation. For example, you may want the STDDEV calc to only take into account the last 12 time periods rather than all time periods currently in status.
    Hope this helps
    Keith Laker
    Oracle EMEA Consulting
    OLAP Blog: http://oracleOLAP.blogspot.com/
    OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
    DM Blog: http://oracledmt.blogspot.com/
    OWB Blog : http://blogs.oracle.com/warehousebuilder/
    OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
    DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html

  • Query to find customers who have not purchased anything

    I have a query to find customers who have purchased what we call consumables (using item property) over a given period:
    SELECT T0.CardCode, T0.CardName, T0.DocDate, T0.DocTotal, T1.ItemCode, T1.Dscription,T1.quantity, T2.ItmsGrpNam
    FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry, OITG T2
    WHERE T0.DocDate BETWEEN '[%0]' AND '[%1]' AND T1.ItemCode like '2ssy%' AND  T2.ItmsGrpNam = 'consumable'
    I have another to show customers who have a particular type of equipment:
    SELECT T0.manufSN,T0.itemName,  T3.Name, T2.Address, T2.Street, T2.Block, T2.City, T2.County, T2.ZipCode
    FROM OINS T0 INNER JOIN OCRD T1 ON T0.customer = T1.CardCode INNER JOIN CRD1 T2 ON T1.CardCode = T2.CardCode Inner Join OCPR T3 ON T0.ContactCod = T3.CntctCode
    WHERE T0.manufSN like 'P%' AND T2.AdresType= 'S'
    What I would like is to find those customers who have this equipment (query 2) but who have NOT purchased and consumables in say the last year.
    I have tried using Excel by finding duplicates and taking those in query 1 from those in query 2 but it's very messy.
    Has anyone done anything like this or got any good ideas?
    Thanks

    Hi Ralph,
    Well, I enjoy teaching, so let's start at the beginning.  SQL is a fairly full-featured language, and it supports recursion and nesting.  That's why the books online often describe elements of the SQL statements as "expression" - it may be more than a field or a simple function occurring there.  Nesting is the little puppy we used here.
    Now, in your first post, you said:  "What I would like is to find those customers who have this equipment (query 2) but who have NOT purchased and consumables (query 1) in say the last year."
    So, our common point between the two queries is the customer, the CardCode.  That's what this part does:  F0.CardCode = T0.Customer.  In my internal convention, I used F for Filter.  So we only want the results in the filter where the CardCode matches the CardCode/Customer from the main query tables.  It's the sole contact point between the two queries.
    You also said you wanted only the items where they had purchased no consumables, which basically translates into: a count of the records equals 0.  Now, since all we're interested in from the second query, the consumables query is how many records we returned, we get rid of all the columns except for one that we apply a COUNT to.  After that, it's a simple criteria:  the result of the second query has to equal 0.  This is how the criteria looks after you take out all the details and put only the important brackets in:  (SELECT COUNT...FROM...WHERE...) = 0.
    This might be confusing at first, because most of the time we return recordsets from queries, but a standard feature of SQL is to return a value of any data type if the query returns a single row and a single column.  This wouldn't work at all if we had more than one column in our nested query (or would require lots of tweaking), and although it returns a number of results in the complete process of the whole SQL statement, it only returns one result for each row.
    Regards,
    Mark Dielmann
    Edited by: Mark Dielmann on Nov 13, 2009 12:30 PM - Forum doesn't support advanced formatting on answered questions.
    Edited by: Mark Dielmann on Nov 13, 2009 12:32 PM - Salutations and more formatting.
    Edited by: Gordon Du on Nov 13, 2009 10:35 AM - There are maximum characters limitation for correct format

  • Query For Finding Yearly Opening and Closing Balance for All the Items

    Hi Experts,
    I am working on Query Based Report for finding the Yearly Opening and Closing Stock for all the Items
    i will give yearwise selection and I want opening and closing stock in between that years
    Warm Regards,
    Sandip Kokate
    Edited by: Sandipk on May 20, 2011 1:58 PM

    Hi,
    Declare @SDate DateTime
    Declare @EDate DateTime
    Declare @Whse nvarchar(10)
    Set @SDate= (SELECT min(F_RefDate)  FROM  OFPR T1 where  T1.[Name] ='[1%]' )
    Set @EDate= (SELECT max(T_RefDate)  FROM  OFPR T1 where  T1.[Name] ='[%1]' )
    Set @Whse=(Select Max(s2.Warehouse) from OINM S2 Where S2.Warehouse = '[%2]')
    BEGIN
    Select @Whse as 'Warehouse', a.Itemcode, max(a.Dscription) as ItemName,
    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
    Where N1.DocDate < @SDate and N1.Warehouse = @Whse 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 Where N1.DocDate >= @SDate and N1.DocDate <= @EDate
    and N1.Inqty >0 and N1.Warehouse = @Whse 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 Where N1.DocDate >= @SDate and N1.DocDate <=@EDate and N1.OutQty > 0
    and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription) a, dbo.OITM I1
    where a.ItemCode=I1.ItemCode
    Group By a.Itemcode Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0 Order By a.Itemcode
    END
    I hope this will work for you.
    In above query you can also user OFPR.Code, OFPR, Category OFPR.Indicator instead of OFPR.Name.
    Regards
    Vaibhav Anharwadkar
    Edited by: Vaibhav Ancharwadkar on May 24, 2011 9:23 AM

  • Need helping in writing query for finding percentage of duration

    Can any one please help in writing query for this.
    The table is like this :-
    ID     Region     Month     Duration
    I1 R1     Jan     80
    I2     R2     Jan     70
    I3     R1     Jan     70
    I4     R3     Jan     40
    I5     R1     Feb     80
    I6     R2     Feb     30
    I7     R3     Mar     100
    I want to write a query to find
    % of duration for each and every region against each and every month.
    Please help in solving this query. I am in urgent need of this.
    Thanks in advance.

    I also have to do in MS Access 2003You also have to ask into an other forum since here it's an Oracle forum, to try to find Oracle solution.
    Nicolas.

  • Query for Finding the Daily Cumulative Production Total

    Hi Experts,
    I want Query based Report for finding Daily Cumulative i.e Running Production Total
    Suppose Yesterdays Production for Item A0001 is 20 and Todays Prodction is 20 then it will show 50 but it shout be datewise selection.
    Warm Regards,
    Sandip Kokate

    Hello
    Report Scenario as follow
    Item Code    Item name    Todays Producion     Yesterdays Production   Total Productio
    A001           Computer     20                                    20                                  40
    A002           Mouse          10                                    05                                  15
    A003           CPU              15                                    05                                  20
    This is Exact Report
    Regards,
    Sandip Kokate

  • Recursive query for finding parents and children against two tables

    Hi I have two tables where the data is stored hierarchially.
    I have found using connect_by, level and other oracle functions doing its job when the data is in one table.
    Can I traverse against two tables by using the same oracle functions.
    My Table A can go 2 levels deep in my hierarchy and level 3 and so forth has to be done against a different table.
    Appreciate your insight..
    Thanks in advance

    The number of levels that I can traverse in the first table is dynamic (sometimes 2 levels and sometimes 3 levels and actually no level limit) and then has to dynamically start looking at second table for finding any more levels in the other table.
    I was able to implement them seperately and union them.
    I was more looking for a comprehensive solution to reduce the number of lines that I have to maintain...
    Thanks in advance
    Edited by: user566193 on Jan 15, 2010 1:58 PM

  • Report or Query for analysing Changes made in a Purchase Order

    Hi All,
    Item changes to a PO can be seen easily by using Environment-->Item Changes.
    Is there a way to use this as a query or report so it is possible to search many PO's at the same time to find the date of a specific change. For example, delivery date completed flag set to complete, see the date this was made.
    Thanks.

    Hi,
    SAP has provided two reports that you can use for capturing all changes you have made to your POs -
    1)   RSSCD100; and
    2)   CHANGEDOCU_READ
    Both reports shall be run with Object Class EINKBELEG.
    Cheers,
    HT

  • Report for finding G/L account per purchasing document / reservation

    Is there a report to get a list of G/L account for Purchasing documents / Reservations? If not, can a new scope of list for any standard report such as ME2N / ME2B be created to include the G/L account list?

    Hi,
    As division is not header field of invoice it is not available in accounting document header as well. Thus it will not be available in any standard reports showning items per account. I'm affraid you need to develop your own report or try to extend existing using user-/customer-exits.
    You can find more information in OSS note 13131.
    Regards,
    Marcin

  • Query for finding shortest path

    I know nothing about Oracle Spatial. Just want to know if this query is possible using Spatial.
    Given the following data for undirected weighted graph,
    v1: vertex 1
    v2: vertex 2
    w: weight between vertices v1 and v2(or, distance of edge)
    table name : wgraph
    v1  v2  w
    k   a    2
    m  a    3
    k   c    1
    k   d    4
    c   b    2
    h   d    3
    c   h    3
    h   e    4
    e   b    4
    m  b    6Can I make a query which gives the shortest path from vertex 'a' to vertext 'e' using Spatial?
    If this possible, that query gives the following result. (row-spanning form)
    I think this is almost impossible using just a hierachical query.
    Any method for this in Oracle Spatial?
    spath
    a
    k
    c
    b
    e
    This is not a sort of homework or exam, just my interest.
    Thx in advance.
    Query Your Dream & Future at
    http://www.soqool.com

    yes why not! in your case just create a logical network- called LRS Network and insert your vertices in node- table and additional information plus cost in the link table.
    you can find ways using by dijkstra and A*

  • Query for Find Mode Fails-AutoGenerated WHERE clause missing quotation mark

    Using Oracle JDev 10.1.3.2. In 'Find Mode' the query execution fails.
    The error shown below is caused by the WHERE clause statement. The column name is quoted in the database but the code generated by the ADF framework does not use quotes. As a result the column name is illegal. Is there a way to hint to the ADF framework to ALWAYS use quotation marks?
    (oracle.jbo.SQLStmtException) JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (SELECT "PLATE","WROW","WCOL","WFIELD","AVGNUC.NUC_CELL_INTENSITY","MEDNUC.NUC_CELL_INTENSITY","AVGORG.INCLUSION_BCKG_INTE","MEDORG.INCLUSION_BCKG_INTE","MEDORG.COUNT","MEDORG.SPACING","MEDORG.NEIGHBOR_COUNT" FROM ICSUMSTAS_1888_295) QRSLT WHERE ( ( (MEDORG.COUNT >0) ) )

    It is true that these are not the most column 'friendly' names, but they are what they are. In the database these columns are quoted and they must be so in order for the query to work correctly.
    The suggestion of directly manipulating the View Criteria is a good one and I have implemented a solution based on it but it's cumbersome. Here is how it works:
    First, use the default query mode UI to add new View Criteria. If you were to execute the query at this point it would fail due to the columns names not being quoted. So, instead, implemented my own execute query button that first uses the View Criteria to create a properly quoted WhereClause for the ViewObject.
    I then reset the ViewCriteria (or they will interfere with the WhereClause), set the custom constructed WhereClause on the ViewObject, and re-execute the query. The cumbersome part is that I have to create my own parser for user input to write a valid WhereClause. And when the user uses query mode again the previously set ViewCriteria have been reset (which is annoying, and not the typical query mode behavior which might confuse the user)
    below are some of my code snippets:
    * This action is triggered by clicking the FIND button on the UI.
    * It uses a combination of the ViewCriteria default UI and custom code that processes
    * user input into a whereClause for the ViewObject
    private void jbFind_actionPerformed(ActionEvent e) {
    jbAddRow.setEnabled(false);
    //reset old where clause
    System.out.println("OLD WHERE:"+myView.getWhereClause());
    myView.setWhereClause(null);
    String customWhere=getCustomWhere();
    /* The case for null and blank View Criteria is tested below
    * when there are blank ViewCriteria the sequence (--) is generated from getCustomWhere
    * Note the use of contains instead of equals
    * The use of equalIgnoreCase etc for unexplained reasons seem to fail to detect when customWhere is (--)
    if(customWhere==null||customWhere.contains("(--)")){
    return;
    }else{
    /*remove ViewCriteria because they can not handle special Column names
    * That's why we go into the trouble of creating our own find function
    myView.getViewCriteria().removeAllElements();
    myView.setWhereClause(customWhere);
    myView.executeQuery();
    jUNavigationBar1.doAction(JUNavigationBar.BUTTON_EXECUTE);
    jTable1.revalidate();
    private String getCustomWhere(){
    StringBuffer custom=new StringBuffer();
    ApplicationModule am = (ApplicationModule) panelBinding.getApplication().getDataProvider();
    DCJboDataControl jbodc = new DCJboDataControl(am);
    JUIteratorBinding iterBinding = new JUIteratorBinding(jbodc,myView );
    int criteriaCount=iterBinding.getViewCriteria().getRowCount();
    //Validation when no ViewCriteria are defined
    if (criteriaCount==0){
    System.out.println("ViewCriteria Count: "+criteriaCount);
    return null;
    }else{
    System.out.println("ViewCriteria Count: "+criteriaCount);
    int attr=iterBinding.getViewCriteria().getCurrentRow().getAttributeCount();
    int criteriaRows=iterBinding.getViewCriteria().getAllRowsInRange().length;
    String[] attrNames=iterBinding.getViewCriteria().getCurrentRow().getAttributeNames();
    for (int r=0;r<criteriaRows;r++)
    {custom.append("(");
    for (int k=0;k<attr;k++){
    if(iterBinding.getViewCriteria().getRowAtRangeIndex(r).getAttribute(k)!=null){
    custom.append("(\""+attrNames[k]+"\"");// LIKE '"+(String)iterBinding.getViewCriteria().getRowAtRangeIndex(r).getAttribute(k)+"') AND ");
    //trim white space
    String attrK=((String)iterBinding.getViewCriteria().getRowAtRangeIndex(r).getAttribute(k)).trim();
    String qual=attrK.substring(0,1);
    if(qual.equalsIgnoreCase(">")||qual.equalsIgnoreCase("<")||qual.equalsIgnoreCase("=")||qual.equalsIgnoreCase("!")){
    custom.append(" "+qual+"'"+attrK.substring(1)+"') AND " );
    }else{
    custom.append(" LIKE '"+(String)iterBinding.getViewCriteria().getRowAtRangeIndex(r).getAttribute(k)+"') AND ");
    }custom.append("--");
    custom.append(")");
    custom.append(" OR ");
    }//end criteria rows
    custom.append("--");
    //now need to remove terminal AND and OR tagged with --
    String cleanWhere=custom.toString().replaceAll("AND --","").replaceAll("OR --","");
    System.out.println("NEW CUSTOM WHERE: "+cleanWhere);
    return cleanWhere;
    }

  • GREP query for find/change operation

    Hi everyone,
    In the following line, there's a comma after the first name. This type of formatting is repeated hundreds of times on a number of pages so I need to use a GREP find/change query to remove the comma after the first name and replace it with a space.
    Firstname,Lastname,State
    I wondered if something could tell me what the GREP code would be?
    Appreciate any assistance.

    function(){return A.apply(null,[this].concat($A(arguments)))}
    ..  it's also doing it for the second comma
    That's impossible. You must have entered something else than Scott's code.

  • Query for finding data during special holidays

    Hi, i have a table for special holidays that looks like this:
    PROFILE_DAY
    VAR_DATE
    REGULAR_HOLIDAY
    1/1/2013
    H_WEEK_THURSDAY
    3/28/2013
    H_WEEK_FRIDAY
    3/29/2013
    REGULAR_HOLIDAY
    12/24/2013
    REGULAR_HOLIDAY
    12/25/2013
    REGULAR_HOLIDAY
    12/31/2013
    And another table (LOAD_PROFILE_TEST), which contains LOAD_PROF1 values from (TIME_EQ) 0 to 24 at intervals 0.25 for (PROFILE_DAY) MONDAY to SUNDAY including REGULAR_HOLIDAY, H_WEEK_THURSDAY and H_WEEK_FRIDAY.  All in all, this table contains 970 records (97 records between 0 to 24 with interval of 0.25 per PROFILE_DAY, with 10 distinct PROFILE_DAY).
    TIME_EQ
    PROFILE_DAY
    LOAD_PROF1
    LOAD_PROF2
    0
    REGULAR_HOLIDAY
    11.47
    0.25
    REGULAR_HOLIDAY
    11.27
    0.5
    REGULAR_HOLIDAY
    11.3
    0.75
    REGULAR_HOLIDAY
    11.08
    0
    MONDAY
    11.27
    0.25
    MONDAY
    11.33
    0.5
    MONDAY
    11.18
    Now, I have this query to update value of LOAD_PROF2 of the said table whenever parameters V_DATE_OUT & V_DATE_IN is entered:
    UPDATE LOAD_PROFILE_TEST
         SET LOAD_PROF2 = LOAD_PROF1 + :LOAD_DIFF
         WHERE  UPPER(PROFILE_DAY) IN (select UPPER(to_char(:V_DATE_OUT + (level-1), 'fmDAY'))
                       from  dual
                       connect by level <=  :V_DATE_IN - :V_DATE_OUT  + 1
    where :LOAD_DIFF is a certain pre-determined value.
    This query works fine if i am trying to update regular days from MONDAY to SUNDAY.  What i would like to do is to determine if the two parameter dates, V_DATE_OUT & V_DATE_IN would fall under any of the holidays on the first table LOAD_PROFILE_TEST, then update only those rows.  For example, V_DATE_OUT = 12/02/2013, Monday and V_DATE_IN = 12/06/2013, Friday.  The query above would update the values of LOAD_PROF2 for PROFILE_DAY -  MONDAY to FRIDAY, corresponding to dates 12/02/2013 and 12/06/2013.  If however, V_DATE_OUT = 12/23/2013, Monday and V_DATE_IN = 12/27/2013, Friday, this should update the rows corresponding to PROFILE_DAY - MONDAY for 12/23/2013, THURSDAY for 12/26/2013, FRIDAY for 12/27/2013, and REGULAR_HOLIDAY for the dates 12/24/2013 and 12/25/2013 since these two are included in the first table (table of holidays).  This same scenario will work the same way when V_DATE_OUT  and/or V_DATE_IN fall in the dates 3/28/2013 and 3/29/2013.  All other dates not included in the table for special holidays will be treated according to the day they fall on (Monday thru Sunday).  I hope my point is clear.  Thank you in advance.

    Thanks for your reply.  Firstly, I am using Forms [32 Bit] Version 10.1.2.0.2 (Production).  I will try to explain a little further but I don't know if i can give the exact details of the tables since this would be voluminous. First i have a table REG_HOLIDAYS, whcih contain the following:
    PROFILE_DAY
    VAR_DATE
    REGULAR_HOLIDAY
    1/1/2013
    H_WEEK_THURSDAY
    3/28/2013
    H_WEEK_FRIDAY
    3/29/2013
    REGULAR_HOLIDAY
    12/24/2013
    REGULAR_HOLIDAY
    12/31/2013
    REGULAR_HOLIDAY
    12/25/2013
    Now i have another table LOAD_PROFILE_TEST which i will simplify just to show what i wanted to do:
    CREATE
    TABLE LOAD_PROFILE_TEST
    TIME_EQ
    NUMBER (5, 2),
    PROFILE_DAY
    VARCHAR2 (15 BYTE),
    LOAD_PROF1
    NUMBER (6, 2), 
    LOAD_PROF2
    NUMBER (6, 2)
    Here are the sample values of this table:
    TIME_EQ
    PROFILE_DAY
    LOAD_PROF1
    LOAD_PROF2
    0
    Monday
    2
    0
    Tuesday
    2.1
    0
    Wednesday
    2.3
    0
    Thursday
    2.5
    0
    Friday
    2.2
    0
    Saturday
    2.4
    0
    Sunday
    2.3
    0
    Regular_holiday
    1.9
    0.25
    Monday
    2.1
    0.25
    Tuesday
    2.1
    0.25
    Wednesday
    2.4
    0.25
    Thursday
    2.2
    0.25
    Friday
    2.5
    0.25
    Saturday
    2.3
    0.25
    Sunday
    2.3
    0.25
    Regular_holiday
    2.5
    However, in the actual table, TIME_EQ will start with 0 until 24 with interval of 0.25 (i.e 0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, ...23.5, 23.75, 24).  So for a PROFILE_DAY of 'Monday', there will be 97 rows corresponding to TIME_EQ of 0 to 24.  The same is true for Tuesday, Wednesday until Sunday including Regular_holiday.  All in all, this table would contain 776 rows.  LOAD_PROF1 values are random values initally inputted with PROFILE_DAY and TIME_EQ.
    The first goal is to UPDATE this table (LOAD_PROFILE_TEST) by updating the column LOAD_PROF2 by adding a certain parameter value, :LOAD_DIFF, say 0.1. Now, i will have two scenarios to show what i would like to happen.  First, i have two date parameters :V_DATE_OUT and :V_DATE_IN.
    First Case, V_DATE_OUT = 12/15/2013 (Monday); V_DATE_IN = 12/22/2013 (Sunday)
    I will have this query to update said table:
    UPDATE LOAD_PROFILE_TEST
           SET LOAD_PROF2 = LOAD_PROF1 + :LOAD_DIFF
       WHERE   UPPER(PROFILE_DAY) IN (select UPPER(
                                                                     to_char(
                                                                          :V_DATE_OUT + (level-1),
                                                                          'fmDAY'))
                                                                    from  dual
                                                     connect by level <=
                                                           :V_DATE_IN - :V_DATE_OUT  + 1);
    The output of this query would be:
    TIME_EQ
    PROFILE_DAY
    LOAD_PROF1
    LOAD_PROF2
    0
    Monday
    2
    2.1
    0
    Tuesday
    2.1
    2.2
    0
    Wednesday
    2.3
    2.4
    0
    Thursday
    2.5
    2.6
    0
    Friday
    2.2
    2.3
    0
    Saturday
    2.4
    2.5
    0
    Sunday
    2.3
    2.4
    0
    Regular_holiday
    1.9
    0.25
    Monday
    2.1
    2.2
    0.25
    Tuesday
    2.1
    2.2
    0.25
    Wednesday
    2.4
    2.5
    0.25
    Thursday
    2.2
    2.3
    0.25
    Friday
    2.5
    2.6
    0.25
    Saturday
    2.3
    2.4
    0.25
    Sunday
    2.3
    2.4
    0.25
    Regular_holiday
    2.5
    Since, 12/15/2013 up to 12/22/2013 is from Monday to Sunday without having a particular day included in the first table, REG_HOLIDAYS, therefore all the rows with Monday to Sunday are updated.
    Second Case, V_DATE_OUT = 12/23/2013 (Monday); V_DATE_IN = 12/29/2013 (Sunday)
    Take note that 12/24 and 12/25 are included in the first table, REG_HOLIDAYS, therefore i need a query so that this would be my output afterwards:
    TIME_EQ
    PROFILE_DAY
    LOAD_PROF1
    LOAD_PROF2
    0
    Monday
    2
    2.1
    0
    Tuesday
    2.1
    0
    Wednesday
    2.3
    0
    Thursday
    2.5
    2.6
    0
    Friday
    2.2
    2.3
    0
    Saturday
    2.4
    2.5
    0
    Sunday
    2.3
    2.4
    0
    Regular_holiday
    1.9
    2.0
    0.25
    Monday
    2.1
    2.2
    0.25
    Tuesday
    2.1
    0.25
    Wednesday
    2.4
    0.25
    Thursday
    2.2
    2.3
    0.25
    Friday
    2.5
    2.6
    0.25
    Saturday
    2.3
    2.4
    0.25
    Sunday
    2.3
    2.4
    0.25
    Regular_holiday
    2.5
    2.6
    As can be seen, since 12/23/2013 up to 12/29/2013 is from Monday to Sunday, rows with Monday upto Sunday should be updated, HOWEVER, since 12/24 and 12/25 which falls on a Tuesday and a Wednesday also were declared as holidays (included in the REG_HOLIDAYS table),  instead of updating rows with PROFILE_DAY of Tuesday and Wednesday, the query should instead update rows with Regular_holiday as PROFILE_DAY and leave as is the rows with Tuesday and Wednesday.  Additional note, days declared in the REG_HOLIDAYS table with PROFILE_DAY of Regular_holidays are treated as DISTINCT as in the case of 12/24 and 12/25.
    The query you gave me gives the correct value if the involved days between V_DATE_OUT and V_DATE_IN is from Monday to Sunday only, otherwise it always gives Regular_holiday only regardless of the other dates queried.  As in the first case above, it would give Monday to Sunday (correct) but for the second case, it will only give Regular_holiday, the other days (Monday, Thursday, Friday, Saturday and Sunday) was not outputted.
    I hope this became clearer since i will still be needing this for another query which i will inquire again after resolving this issue.  Thanks a lot for your help.

  • Query for finding Unpacked Item

    Hi
    I created a Sales Order and Manual Packing is completed.
    Example :
    In a Sales order , having different 25 items, I missed to pack one item in the sales order.
    I wanted to write a query (report) to find the item which is packed and unpacked, group by the sales order.
    Pls help me out in the table , column name, status of the column.
    If you have a sample query,pls do share with me.
    Regards
    Yram

    I don't have a , But you can join tables like this:
    See delivery lines associated with order line (source_type=OE)
    check respective parent delivery line (source_type=WSH) --This is delivery line created with respect to LPN
    join given delivery with wms_license_plate_numbers to find LPN

  • Sql query for finding a string in a column of a table

    Hi All,
    I have an issue, I have gotten a string ie '1D USD PRIME' and I have access to oracle's dictionary tables and views such as (all_source, all_tab_cols etc), my requirement is to find which table' column holds my above mentioned string, so I mean both the table name and the column name, it could be that this string might exist in more than 1 table so I want all the tables that holds it.
    Regards
    Rahul

    Hi All,
    I think you misunderstood my question, so may be I didnt ask it properly, so here it is I am explaining in detail with an example.
    Suppose I have 10 users with 10 different user name's in a database and I am the 11th user as DBA, every 10 of these users have created some tables lets say 20 tables each by every user making a count of the total tables as 200, now lets say 10 of 200 tables has a column ie fname with value as 'rahul', I want to search the string 'rahul' from all the 200 tables that which of the tables contains this string along with the column name.
    I hope this time my question is clear, the point is I just know of a value and I dont know the table name and column name where it may actually residing, futher I want to search tables of other users as well.
    Regards
    Rahul

Maybe you are looking for

  • Unable to get the data from table controller

    Dear All, I am facing the following problem in BSP tableview, I am having tableview on page as below <htmlb:tableView id              = "reportsTable2"                        headerVisible   = "true"                        headerText      = "Pending

  • OSMF Player Error: URL missing from Media tag - HTTP Live

    When I try to play an HTTP Live Stream using OSMF Player, I get "URL missing from Media tag" error. I installed Flash MS4.0 with Apache2.2. My live manifest file (f4m) is below. http://localhost/live/events/livepkgr/events/_definst_/liveevent.f4m <ma

  • Workflow with EP

    Hi, does anybody have materials regarding workflow in EP, the UWL usage and itegration with MSS. Regards, Vijay

  • File Menu Missing (File, Edit, View, Document..."

    This is my first time using this forum - let me know if I should ask this elsewhere.  I am a seasoned user of Adobe Acrobat, but I am now using Windows 8 and am having some challenges.  For some reason, the top "Menu" bar has disappeared when I open

  • Changing account

    At the present time, I am using my work lap top as my main computer to downloading, managing my library ect. I am going to be changing jobs, so I will not have this computer any more. I want to set up my home computer to replace the lap top. My home