Query advice for comparing data

Looking for advice on how to create query that compares two period (Date Range of sale totals)
Total sales for year 2007 and 2008 in two separate columns.

You may try this one:
SELECT T0.CardCode, T0.CardName,
(SELECT SUM(DocTotal) FROM OINV WHERE CardCode = T0.CardCode
AND YEAR(DocDate) = '2007') - (SELECT SUM(DocTotal) FROM ORIN
WHERE CardCode = T0.CardCode
AND YEAR(DocDate) = '2007')  AS [Sales 2007],
(SELECT SUM(DocTotal) FROM OINV WHERE CardCode = T0.CardCode
AND YEAR(DocDate) = '2008') - (SELECT SUM(DocTotal) FROM ORIN
WHERE CardCode = T0.CardCode
AND YEAR(DocDate) = '2008')  AS [Sales 2008]
FROM [dbo].[OCRD] T0 LEFT JOIN [dbo].[OINV] T1 ON T1.CardCode = T0.CardCode
WHERE T0.CardType = 'C'
GROUP BY T0.CardCode, T0.CardName
Thanks,
Gordon

Similar Messages

  • Function module for comparing dates and times

    Hi,
    I have a date and time stamp in one filed for example as below:
    20070125183045
    (the first 8 are date in YYYYMMDD format, the next 6 is time in HHMMSS format). Now I want to compare this value to another such value in terms of date and time. First I want to compare dates and then times. Do you know any function module that can serve this purpose?
    Thanks very much!

    You can compare these using the function module DURATION_DETERMINE.  This fuction will give you the difference, and it can be in a view different units, such as the difference in days, months, etc.
    Funciton module takes in Start date and time and end date and time.
    Regards,
    RIch HEilman

  • Formula for comparing dates and display data

    I have 3 objects on my query: Date, Product name and Quantity sold
    I have a table on my reports showing the top 3 products by quantity sold, and I want to add the quantity sold today on the same table.
    I am looking for a formula that compares de dates provided by the query with current date and only displays on the cell the quantity for the current day.
    Any ideas are welcome!

    As per my understanding, you want to display the today's sale of the product while the ranking is aaplied on the total quantity
    sold.
    You can create a new variable with either of the following two definitions:
    Today's Date = CurrentDate()
    Today's Sale = Sum([Quantity Sold]) where ([Date]=[Today's Date])
    or
    Today's Sale = If(([Date]=[Today's Date]) Then Sum([Quantity Sold])
    Note: The two date formats should be same.
    For getting the top three products you can use the hidden column(font, border and background white) and apply the ranking on
    the total sale coming from the DB.
    Regards,
    Rohit

  • How can I make CONTAINS query work for a date range

    In either 9i or 10g (eventual). I have a CONTEXT index that contains multiple columns from multiple tables and using a USER_DATASTORE. E.g., I have names that come from 3 different table locations and dates that come from 4. I can index them fine but how can I perform a single consolidated CONTAINS query against the single CONTEXT index to do the following:
    smith WITHIN lname AND john WITHIN fname AND dob BETWEEN '19870315' and '19970315'
    I know that I can use a mixed query but this is inefficient (esp since I have birth dates in multiple tables). Is there any algorithm for a range operator (>, <, between?) within the CONTAINS operator?
    CTXCAT index is not an option, as I have many text columns I am searching.
    Thanks!

    When you run the cdstore.sql, in addition to creating the ctx_cd package, it also creates the friedman package that contains the algorithm that the ctx_cd package uses. You could use the functions from that friedman package in your procedure for your user_datastore and in the creation of your query string, as demonstrated below.
    SCOTT@orcl_11g> CREATE OR REPLACE PROCEDURE my_proc
      2    (p_rowid IN           ROWID,
      3       p_clob     IN OUT NOCOPY CLOB)
      4  AS
      5  BEGIN
      6    FOR r IN
      7        (SELECT emp.ename, emp.job, emp.hiredate, dept.dname
      8         FROM      emp, dept
      9         WHERE  emp.deptno = dept.deptno
    10         AND      emp.ROWID = p_rowid)
    11    LOOP
    12        DBMS_LOB.WRITEAPPEND (p_clob, 7, '<ename>');
    13        DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r.ename), r.ename);
    14        DBMS_LOB.WRITEAPPEND (p_clob, 8, '</ename>');
    15        DBMS_LOB.WRITEAPPEND (p_clob, 5, '<job>');
    16        DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r.job), r.job);
    17        DBMS_LOB.WRITEAPPEND (p_clob, 6, '</job>');
    18        DBMS_LOB.WRITEAPPEND (p_clob, 7, '<dname>');
    19        DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r.dname), r.dname);
    20        DBMS_LOB.WRITEAPPEND (p_clob, 8, '</dname>');
    21        DBMS_LOB.WRITEAPPEND (p_clob, 10, '<hiredate>');
    22        -- apply friedman algorithm to date column ------------------
    23        friedman.init
    24          (TO_NUMBER (TO_CHAR (TO_DATE (19000101, 'YYYYMMDD'), 'J')),
    25           TO_NUMBER (TO_CHAR (TO_DATE (21001231, 'YYYYMMDD'), 'J')));
    26        DBMS_LOB.WRITEAPPEND
    27          (p_clob,
    28           LENGTH (friedman.encodedate (r.hiredate)),
    29           friedman.encodedate (r.hiredate));
    30        --------------------------------------------------------------
    31        DBMS_LOB.WRITEAPPEND (p_clob, 11, '</hiredate>');
    32    END LOOP;
    33  END my_proc;
    34  /
    Procedure created.
    SCOTT@orcl_11g> SHOW ERRORS
    No errors.
    SCOTT@orcl_11g> BEGIN
      2    CTX_DDL.CREATE_PREFERENCE ('my_datastore', 'USER_DATASTORE');
      3    CTX_DDL.SET_ATTRIBUTE      ('my_datastore', 'PROCEDURE', 'my_proc');
      4  END;
      5  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g> CREATE INDEX my_index ON emp (ename)
      2  INDEXTYPE IS CTXSYS.CONTEXT
      3  PARAMETERS
      4    ('DATASTORE     my_datastore
      5        SECTION GROUP CTXSYS.AUTO_SECTION_GROUP')
      6  /
    Index created.
    SCOTT@orcl_11g> EXEC DBMS_STATS.GATHER_TABLE_STATS (USER, 'DEPT')
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g> EXEC DBMS_STATS.GATHER_TABLE_STATS (USER, 'EMP')
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g> VARIABLE cstring VARCHAR2(4000)
    SCOTT@orcl_11g> BEGIN
      2    :cstring := 'smith WITHIN ename';
      3    :cstring := :cstring || ' AND ' || 'clerk WITHIN job';
      4    :cstring := :cstring || ' AND ' || 'research WITHIN dname';
      5    -- apply friedman algorithm to search criteria ---------------------------
      6    friedman.init
      7        (TO_NUMBER (TO_CHAR (TO_DATE (19000101, 'YYYYMMDD'), 'J')),
      8         TO_NUMBER (TO_CHAR (TO_DATE (21001231, 'YYYYMMDD'), 'J')));
      9    :cstring := :cstring || ' AND ((' ||
    10               friedman.integercontainscriteria
    11                 (TO_NUMBER (TO_CHAR (TO_DATE ('19800315', 'YYYYMMDD'), 'J')),
    12                  TO_NUMBER (TO_CHAR (TO_DATE ('19810315', 'YYYYMMDD'), 'J')),
    13                  'B')
    14               || ') WITHIN hiredate)';
    15    ---------------------------------------------------------------------------
    16  END;
    17  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g> SET AUTOTRACE ON EXPLAIN
    SCOTT@orcl_11g> SELECT *
      2  FROM   emp
      3  WHERE  CONTAINS (ename, :cstring) > 0
      4  /
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
    Execution Plan
    Plan hash value: 1887222286
    | Id  | Operation                   | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |          |     1 |    37 |     4   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| EMP      |     1 |    37 |     4   (0)| 00:00:01 |
    |*  2 |   DOMAIN INDEX              | MY_INDEX |       |       |     4   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("CTXSYS"."CONTAINS"("ENAME",:CSTRING)>0)
    SCOTT@orcl_11g>

  • Business rule for compare data in form

    Hi all,
    Let us explain my scenario,
    I have 2 dynamic calc members in a dataform. I just want to compare those 2 member rows( data compare) and show some message.
    is there any way i can make?
    can i create one business rule to make this happend? is it possible? If its possible can you give me your thoughts on this.
    Any information would be helpful.
    Thanks in advance.

    Sorry about that . . . . I read the first post and assumed the code was related to a business rule instead of JavaScript - should have looked closer.
    I would do a couple of things:
    1) Simplify your code. Why have a separate function? Why not drop all the logic into validateForm?
    2) Why haven't you populated the app name and form name in validateForm? (sorry if I missed this in the rest of the post somewhere)
    3) Insert alerts within the code that cycles through the cells. Something like this:
    cellVal = getCellValueXY(col,row);
    alert(" Column: " + col + "\n" +
    " Row: " + row + "\n" +
    " Cell Value: " + cellVal);
    This will tell you exactly how your JavaScript is evaluating each cell. This can help when you're dealing with floating point decimal issues. (you entered 10, but it's being evaluated as 10.00000001) If this ends up being your issue (floating point issues), let me know and I'll show you how to get around this.
    If you throw enough alerts at this code, your issue will finally show itself.
    4) I wouldn't assign values to "startCol" and "numberGridCols". I believe these variables are set elsewhere in the code (not in YOUR code, but in EnterData.js or somewhere else).
    Instead, I would use my own variables
    5) I would structure the code more like this: (I haven't validated this or tested it . . . . use this for suggestion purposes only)
    function validateForm()
    var valid = true;
    var c;
    if (equalsIgnoreCase(applicationName,"PUT YOUR APP NAME HERE")) {
    if (equalsIgnoreCase(formName,"PUT YOUR FORM NAME HERE")) {
    for (c=3; c<numCols; c++) {
    if((grid23[c] != missing) || (grid24[c] != missing)) {
    var actualVal = getCellVal(23,c);
    var budgetVal = getCellVal(24,c);
    if(actualVal != budgetVal){
    valid = false;
    if (!validated) {
    alert("The numbers you have submitted for SII are not equal to Actuals. Please adjust your numbers.\n");
    return valid;
    I hope this helps. Hopefully there aren't too many bugs in this.
    - Jake

  • Query need for transpose data output

    Dear All,
    I have a query regarding transpose output.
    for ex. I created one table employee in database
    create table emp(emp_no number,dept_id number(10));
    it is having data like....
    emp_no dept_id
    101 10
    102 20
    103 10
    104 10
    105 20
    so I want the output in transpose format like
    dept_id emp_no1 emp_no2 emp_no3
    10 101 103 104
    20 102 105
    can anybody suggest me any query for the above output.
    Thanks...
    Prashant....

    select dept_id
         , max (decode (emp_no, 101, emp_no))
         , max (decode (emp_no, 102, emp_no))
         , max (decode (emp_no, 103, emp_no))
         , max (decode (emp_no, 104, emp_no))
         , max (decode (emp_no, 105, emp_no))
      from test
    group by dept_idas in
    SQL> with test as
      2  (
      3  select 101 emp_no, 10 dept_id from dual union all
      4  select 102 emp_no, 20 dept_id from dual union all
      5  select 103 emp_no, 10 dept_id from dual union all
      6  select 104 emp_no, 10 dept_id from dual union all
      7  select 105 emp_no, 20 dept_id from dual
      8  )
      9  select dept_id
    10       , max (decode (emp_no, 101, emp_no)) emp1
    11       , max (decode (emp_no, 102, emp_no)) emp2
    12       , max (decode (emp_no, 103, emp_no)) emp3
    13       , max (decode (emp_no, 104, emp_no)) emp4
    14       , max (decode (emp_no, 105, emp_no)) emp5
    15    from test
    16   group by dept_id
    17  ;
       DEPT_ID       EMP1       EMP2       EMP3       EMP4       EMP5
            20                   102                              105
            10        101                   103        104

  • Query needed for Cumulative data

    HI Friends,
    I need output like this.
    Frequency     Percent (%) Cumulative
    Frequency     Cumulative Percent
    4468     0.91     4468     0.91
    21092     4.31     25560     5.23
    57818     11.82     83378     17.05
    6274     1.28     89652     18.33
    I am using Oracle 9i.
    My output data like this and I need to write the query for 3 columns (Percent ,Cumulative frequency and Cumulative percent)
    1:The formula for Percent column data is (Frequency/Sum of cumulative frequency)*100
    2:The formula for Cumulative Frequency column data is (Cumulative of Frequency column data)
    3:The formula for Cumulative Percent column data is (Cumulative of Percent column data)
    What should be the analytic function and how to write the query.
    Thanks,
    Lony

    Hi Friends,
    I need output like this.
    Frequency Percent (%) Cumulative Frequency Cumulative Percent
    4468 0.91 4468 0.91
    21092 4.31 25560 5.23
    57818 11.82 83378 17.05
    6274 1.28 89652 18.33
    I am using Oracle 9i.
    My output data like this and I need to write the query for 3 columns (Percent ,Cumulative frequency and Cumulative percent)
    1:The formula for Frequency column data is sum of (dd+cc+mc_cc_mc).
    1:The formula for Percent column data is (Frequency/Sum of cumulative frequency)*100
    2:The formula for Cumulative Frequency column data is (Cumulative of Frequency column data)
    3:The formula for Cumulative Percent column data is (Cumulative of Percent column data)
    What should be the analytic function and how to write the query.Please find the sample data and table script.
    CREATE TABLE all_lony (
    campno varchar2(20),
    dd INTEGER,
    cc INTEGER,
    mc INTEGER,
    cc_mc INTEGER
    insert into all_lony (campno,dd,cc,mc,cc_mc)
    values(36,156,1320,445,2547);
    insert into all_lony (campno,dd,cc,mc,cc_mc)
    values(40,233,19711,263,885);
    =============
    Please find my query below
    SELECT campno
    || ','
    || dm
    || ','
    || cc
    || ','
    || mc
    || ','
    || cc_mc
    || ','
    || frequency
    || ','
    || per
    ||','
    ||cumulative_fr
    ||','
    || SUM (per) OVER (ORDER BY per ROWS UNBOUNDED PRECEDING)
    FROM (SELECT q3.campno campno, q3.dm, q3.cc, q3.mc, q3.cc_mc,
    q3.frequency, q3.cumulative_fr,
    (q3.Frequency / SUM (q3.cumulative_fr)) * 100 per
    FROM (SELECT q2.campno campno, SUM (q2.dm) dm, SUM (q2.cc) cc,
    SUM (q2.mc) mc, SUM (q2.cc_mc) cc_mc,
    (SUM ( NVL (q2.dm, 0)
    + NVL (q2.cc, 0)
    + NVL (q2.mc, 0)
    + NVL (q2.cc_mc, 0)
    ) frequency,
    SUM (SUM ( NVL (q2.dm, 0)
    + NVL (q2.cc, 0)
    + NVL (q2.mc, 0)
    + NVL (q2.cc_mc, 0)
    ) OVER (ORDER BY SUM ( NVL (q2.dm, 0)
    + NVL (q2.cc, 0)
    + NVL (q2.mc, 0)
    + NVL (q2.cc_mc,0)
    ) ROWS UNBOUNDED PRECEDING)
    cumulative_fr
    from all_lony
    q1 )q2
    GROUP BY q3.campno) q3
    GROUP BY campno, dm, cc, mc,cc_mc, frequency,cumulative_fr)
    Can anybody just verify the query and let me know.

  • What's wrong with my code for comparing date retreived from db and sysdate?

    Hi all,
    I need to retrive date from the DB and compare it to system date.i have posted the code below.i get java.sql.SQL Exception:Io exception:Socket closed.
    What's wrong with the code?please help me.Thanks in advance.
    public boolean date() throws IOException, SQLException {
    Connection con1;
    long millis = System.currentTimeMillis();
    Timestamp timestamp = new java.sql.Timestamp(millis);
    ResultSet rs4 = null;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection(
    "jdbc:oracle:thin:@abc:1605:xyz",
    "cdf", "cdf");
    Statement stmt_exp = con.createStatement();
    rs4 = stmt_exp.executeQuery("SELECT DATE FROM TABLE_NAME")
    while (rs4.next()) {
    Timestamp timestamp2 = rs4.getTimestamp("expire_date");
    con1.close();
    catch (Exception e)
    e.printStackTrace();
    finally
    //ResultSet rs4 = null;
    //Timestamp timestamp2;
    Timestamp timestamp2 = rs4.getTimestamp("expire_date");
    if (timestamp2.compareTo(timestamp) < 0)  //sysdate < exp date
    return true;
    } else {
    return false;
    }

    Didn't you understand what BalusC said? You're closing the connection and then trying to use the ResultSet. The ResultSet will be closed when you close the connection so you can't use it anymore.
    You should close the connection last thing in your code, probably in a finally. And after you close your ResultSet and Statement.
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    ----------------------------------------------------------------

  • Looking for a proper analytical query/solution for below data

    I have data as shown below:
    mob_id     status_code     status_text     media_date
    39585     600     Online     04-Aug-09
    54988     600     Online     05-Aug-09
    39585     600     Online     05-Aug-09
    39585     600     Online     06-Aug-09
    39585     600     Online     07-Aug-09
    39585     600     Online     08-Aug-09
    39585     600     Online     09-Aug-09
    39585     600     Online     10-Aug-09
    39585     600     Online     11-Aug-09
    39585     600     Online     12-Aug-09
    39585     600     Online     13-Aug-09
    39585     600     Online     14-Aug-09
    39585     600     Online     15-Aug-09
    39585     600     Online     16-Aug-09
    39585     700     Deinstall     17-Aug-09
    54988     600     Online     06-Aug-09
    54988     600     Online     07-Aug-09
    54988     600     Online     08-Aug-09
    54988     600     Online     09-Aug-09
    54988     600     Online     10-Aug-09
    54988     600     Online     11-Aug-09
    54988     600     Online     12-Aug-09
    54988     600     Online     13-Aug-09
    54988     600     Online     14-Aug-09
    54988     600     Online     15-Aug-09
    54988     600     Online     16-Aug-09
    39585     600     Online     20-Aug-09
    39585     600     Online     21-Aug-09
    39585     600     Online     22-Aug-09
    39585     600     Online     23-Aug-09
    39585     600     Online     24-Aug-09
    39585     600     Online     25-Aug-09
    39585     700     Deinstall     26-Aug-09
    39585     600     Online     27-Aug-09
    39585     600     Online     28-Aug-09
    39585     600     Online     29-Aug-09
    39585     600     Online     30-Aug-09
    39585     600     Online     31-Aug-09
    39585     600     Online     01-Sep-09
    39585     700     Deinstall     02-Sep-09
    54988     600     Online     17-Aug-09
    54988     600     Online     18-Aug-09
    54988     600     Online     19-Aug-09
    54988     600     Online     20-Aug-09
    54988     600     Online     21-Aug-09
    54988     600     Online     22-Aug-09
    54988     600     Online     23-Aug-09
    54988     600     Online     24-Aug-09
    54988     600     Online     25-Aug-09
    54988     700     Deinstall     26-Aug-09
    69875     600     Online     20-Aug-09
    69875     600     Online     21-Aug-09
    69875     600     Online     22-Aug-09
    69875     600     Online     23-Aug-09
    69875     600     Online     24-Aug-09
    69875     600     Online     25-Aug-09
    69875     600     Online     26-Aug-09
    Using the above data I need to find out the below result set. Can any one help in this?
    occurrnace_seq     mob_id     start_media_date     end_media_date     no_of_days
    1     39585     04-Aug-09     17-Aug-09     13
    2     39585     20-Aug-09     26-Aug-09     6
    3     39585     27-Aug-09     02-Sep-09     6
    1     54988     05-Aug-09     26-Aug-09     21
    1     69875     20-Aug-09          null null
    Here start_media_date can be found with status_code=600 & end_media_date can be found with status_code=700.
    Please look that the mobility_id is starting multiple times.
    Any one can help me in producing this result using SQL or PL/SQL.
    Many thanks in advance.
    Thanks
    Guttiwas

    guttis wrote:
    Can I run this query on a 70 million records? Does it raise any performance problems. If you have any idea, just thorough some possible suggestions to protect such isses.Well, you can certailny run it on 70 million records. How long it will run depends on your hardware, Oracle and OS settings. Said that, there is a simpler solution:
    select  occurrenace_seq,
            mob_id,
            min(case grp when 'start-of-group' then media_date end) start_media_date,
            max(case grp when 'end-of-group' then media_date end) end_media_date,
            max(case grp when 'end-of-group' then media_date end) - min(case grp when 'start-of-group' then media_date end) no_of_days
      from  (
             select  t.*,
                     case
                       when status_text = 'Deinstall' then 'end-of-group'
                       when lag(status_text,1,'Deinstall') over(partition by mob_id order by media_date) = 'Deinstall' then 'start-of-group'
                     end grp,
                     sum(case status_text when 'Deinstall' then 1 else 0 end) over(partition by mob_id order by media_date) +
                     case lag(status_text,1,'Deinstall') over(partition by mob_id order by media_date) when 'Deinstall' then 1 else 0 end occurrenace_seq
               from  your_table t
      where grp in ('start-of-group','end-of-group')
      group by mob_id,
               occurrenace_seq
      order by mob_id,
               occurrenace_seq
    /With your sample:
    with t as (
               select 39585 mob_id,600 status_code,'Online' status_text, to_date('04-Aug-09','dd-mon-yy') media_date from dual union all
               select 54988,600,'Online',to_date('05-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('05-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('06-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('07-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('08-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('09-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('10-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('11-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('12-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('13-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('14-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('15-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('16-Aug-09','dd-mon-yy') from dual union all
               select 39585,700,'Deinstall', to_date('17-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('06-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('07-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('08-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('09-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('10-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('11-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('12-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('13-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('14-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('15-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('16-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('20-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('21-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('22-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('23-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('24-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('25-Aug-09','dd-mon-yy') from dual union all
               select 39585,700,'Deinstall', to_date('26-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('27-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('28-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('29-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('30-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('31-Aug-09','dd-mon-yy') from dual union all
               select 39585,600,'Online',to_date('01-Sep-09','dd-mon-yy') from dual union all
               select 39585,700,'Deinstall', to_date('02-Sep-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('17-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('18-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('19-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('20-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('21-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('22-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('23-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('24-Aug-09','dd-mon-yy') from dual union all
               select 54988,600,'Online',to_date('25-Aug-09','dd-mon-yy') from dual union all
               select 54988,700,'Deinstall', to_date('26-Aug-09','dd-mon-yy') from dual union all
               select 69875,600,'Online',to_date('20-Aug-09','dd-mon-yy') from dual union all
               select 69875,600,'Online',to_date('21-Aug-09','dd-mon-yy') from dual union all
               select 69875,600,'Online',to_date('22-Aug-09','dd-mon-yy') from dual union all
               select 69875,600,'Online',to_date('23-Aug-09','dd-mon-yy') from dual union all
               select 69875,600,'Online',to_date('24-Aug-09','dd-mon-yy') from dual union all
               select 69875,600,'Online',to_date('25-Aug-09','dd-mon-yy') from dual union all
               select 69875,600,'Online',to_date('26-Aug-09','dd-mon-yy') from dual
    select  occurrenace_seq,
            mob_id,
            min(case grp when 'start-of-group' then media_date end) start_media_date,
            max(case grp when 'end-of-group' then media_date end) end_media_date,
            max(case grp when 'end-of-group' then media_date end) - min(case grp when 'start-of-group' then media_date end) no_of_days
      from  (
             select  t.*,
                     case
                       when status_text = 'Deinstall' then 'end-of-group'
                       when lag(status_text,1,'Deinstall') over(partition by mob_id order by media_date) = 'Deinstall' then 'start-of-group'
                     end grp,
                     sum(case status_text when 'Deinstall' then 1 else 0 end) over(partition by mob_id order by media_date) +
                     case lag(status_text,1,'Deinstall') over(partition by mob_id order by media_date) when 'Deinstall' then 1 else 0 end occurrenace_seq
               from  t
      where grp in ('start-of-group','end-of-group')
      group by mob_id,
               occurrenace_seq
      order by mob_id,
               occurrenace_seq
    OCCURRENACE_SEQ     MOB_ID START_MED END_MEDIA NO_OF_DAYS
                  1      39585 04-AUG-09 17-AUG-09         13
                  2      39585 20-AUG-09 26-AUG-09          6
                  3      39585 27-AUG-09 02-SEP-09          6
                  1      54988 05-AUG-09 26-AUG-09         21
                  1      69875 20-AUG-09
    SQL> SY.

  • Need advice for getting data service while traveling abroad

    I will be traveling in Norway and England and want to be able to use GPS on my Galaxy S4.  I can get along without voice service, and can rely on wi-fi for email and internet access.  I will be traveling for about 3 weeks.  Any suggestions?

    All the advise you need is right here Spokaneman! We want you to enjoy your trip to Norway and England. Yes, you can use your phone for data while traveling. Here is a link to our Global trip planner to get all the information about cost and what is needed to use your phone http://vz.to/1aGvDAs . You can add our bundle plan for 100mb for $25.00 per month or voice/data bundle for 100minutes/100sent messages and 100mb for $40.00 per month . You can also pay as you go with is $0.02 cent per KB and $20.48 per mb. Voice calls and text are extra if you're interested in those features.
    KinquanaH_VZW
    Follow us on Twitter @VZWSupport
    If my response answered your question please click the "Correct Answer" button under my response. This ensures others can benefit from our conversation. Thanks in advance for your help with this!!

  • What type of chart should we use for comparing more than 200 items

    Hi Guys, 
    I have a Pie chart graph for comparing data items but this chart becomes cluttered or serves no purpose when categories increase up to 100 or 200 items.
    I have tried collected Pie but still facing same issue.
    When the numbers of Legends increases the chart will become cluttered and this will reduce it readability as shown in the image.  Please share your suggestions for suitable chart type or strategy to overcome this issue.
    Regards

    Hi,
    As you may know, the issue is caused by the excessive items in the category group of the pie chart. The most direct and effective way is to reduce the items in the category group. Generally, we are not always need the report to display all items in the chart.
    In this scenario, we can add a parameter in the report, then use the parameter to filter the corresponding values in the chart.
    Besides, in order to increase the chart readability, we can try to use Column Chart to display those values. And we can “Enable scale breaks” in the Vertical Axis. A scale break is a stripe drawn across the plotting area of a chart to denote a break in continuity
    between the high and low values on a value axis. Use a scale break to display two distinct ranges in the same chart area.
    Reference:
    Add a parameter to filter the data in SSRS
    Add Scale Breaks to a Chart (Report Builder
    and SSRS)
    Hope this helps.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to use Add Query Criteria for the MySQL data Base in Netbeans ?

    How to use Add Query Criteria for the MySQL data Base in Netbeans Visual web pack.
    When the Query Criteria is add like
    SELECT ALL counselors.counselors_id, counselors.first_name, counselors.telephone,counselors.email
    FROM counselors WHERE counselors.counselors_id = ?
    when i run this Query in the Query Window
    i get a error message Box saying
    Query Processing Error Parameter metadata not available for the given statement
    if i run the Query with out Query Criteria its working fine.

    *I am glad I am not the only one who have this problem. Part of issue has been described as above, there are something more in my case.
    Whenever I try to call ****_tabRowSet.setObject(1, userDropList.getSeleted()); I got error message as shown below:*
    The Java codes are:
    public void dropDown1_processValueChange(ValueChangeEvent event) {
    Object s = this.dropDown1.getSelected();
    try {
    this.User_tabDataProvider1.setCursorRow(this.User_tabDataProvider1.findFirst("User_Tab.User_ID", s));
    this.getSessionBean1().getTrip_tabRowSet1().setObject(1, s);
    this.Trip_tabDataProvider1.refresh();
    } catch (Exception e) {
    this.log("Error: ", e);
    this.error("Error: Cannot select user"+e.getMessage());
    SQL statement for Trip_tabRowSet:
    SELECT ALL Trip_Tab.Trip_Date,
    Trip_Tab.User_ID,
    Trip_Tab.Destination
    FROM Trip_Tab
    WHERE Trip_Tab.User_ID = ?
    Error messages are shown below:
    phase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@5abf3f) threw exception: com.sun.rave.web.ui.appbase.ApplicationException: java.sql.SQLException: No value specified for parameter 1 java.sql.SQLException: No value specified for parameter 1
    com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.cleanup(ViewHandlerImpl.java:559)
    com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.afterPhase(ViewHandlerImpl.java:435)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:274)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:240)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
    org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
    org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
    org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
    org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
    com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
    com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
    com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
    com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
    com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
    com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
    com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    tandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
    java.sql.SQLException: No value specified for parameter 1
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
    at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:1674)
    at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:1622)
    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1332)
    at com.sun.sql.rowset.internal.CachedRowSetXReader.readData(CachedRowSetXReader.java:193)
    at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:979)
    at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:1439)
    at com.sun.data.provider.impl.CachedRowSetDataProvider.checkExecute(CachedRowSetDataProvider.java:1274)
    at com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorRow(CachedRowSetDataProvider.java:335)
    at com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorIndex(CachedRowSetDataProvider.java:306)
    at com.sun.data.provider.impl.CachedRowSetDataProvider.getRowCount(CachedRowSetDataProvider.java:639)
    at com.sun.webui.jsf.component.TableRowGroup.getRowKeys(TableRowGroup.java:1236)
    at com.sun.webui.jsf.component.TableRowGroup.getFilteredRowKeys(TableRowGroup.java:820)
    at com.sun.webui.jsf.component.TableRowGroup.getRowCount(TableRowGroup.java:1179)
    at com.sun.webui.jsf.component.Table.getRowCount(Table.java:831)
    at com.sun.webui.jsf.renderkit.html.TableRenderer.renderTitle(TableRenderer.java:420)
    at com.sun.webui.jsf.renderkit.html.TableRenderer.encodeBegin(TableRenderer.java:143)
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:810)
    at com.sun.webui.jsf.component.Table.encodeBegin(Table.java:1280)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:881)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
    at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:271)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:182)
    at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:133)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:244)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
    at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    Also when I tried to update my MYSQL connector / J driver to version 5.1.5 from 5.0.5 (NB 5.5.1) and 5.0.7 (NB 6.1), I could not get it work (looooong time to search some JDBC classes and with no response in the end) on both of my Netbean 5.5.1(on PC) and Netbean 6.1(on laptop) IDEs.
    Could anybody look into this issue.
    Many thanks
    Edited by: linqing on Nov 22, 2007 4:48 AM

  • Query for Old Data that does not match New Data within a given time period

    Hello all,
    One of the reports I need to create is for all associates who went from one department to another within a given time period. The way I ran this report in Reportsmith (pulling from our old system) was to compare the dept field from the beginning date to the dept field at the end date and it would give me those associate's that had moved. I had to do it this way b/c dept changes can happen using several different types of actions (supv change, promotion, etc.), none of them exclusive to just dept changes. We are now using Oracle HRMS and I need to create this same report with this system using SQL.
    Does anyone know how to compare data between two different dates and pull the ones that don't match? Your help will be GREATLY appreciated!
    Warm Regards,
    Yasmin E. Alberto
    HRIS Analyst
    [email protected]

    Hi, Yasmin,
    In the sample data you posted, nobody changed departments between May 1 and May 11. In fact, there were no assignments of any kind between January 16 and May 17, so I wouldn't expect any output for that period.
    A person (or rather, a duck) did change deptartments on May 20, so if you change the upper limit of the date range to
    AND    ASG_LAST_UPDATE_DATE < TO_DATE ('05/21/09', 'MM/DD/RR')you should see her.
    You've probably noticed that this site likes to compress white-space.
    To post formatted text (such as table results or indented code) type these 6 characters:
    (small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

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

  • No data to retrieve in Query 1 for particular User

    Error: No data to retrieve in Query 1 for particular User
    Hello,
    We have webi report in 3.1 version which is running fine in Infoview for particular user.
    But when same report is send into Inbox of other user and if user try to run it in infoview it is giving below error.
    "No data to retrieve in Query 1"
    All the security and  group member level settings for both the user are exactly same. What could be the reason for this behaviour.
    Thanks

    Can you please check user is part of which group in enterprise receipts group.
    Also please check dynamic receipts tab of publication where data can be filtered
    Thanks,
    Swapnil

Maybe you are looking for

  • Plus and minus instead of mouse pointer

    http://www.rwphotographic.com/#/recent/pbs On the site above, the designer has managed to replace the mouse pointer with a plus (+) or minus (-) depending on where the mouse pointer is (either the left hand side of the screen or the right). I'd like

  • How to Disconnect ID CS6 from Creative Cloud

    When I installed Creative Cloud, it replaced my Adobe Application Manager, and took over management of my ID CS6. Now my CC subscription has expired. When I try to launch ID CS6, a message appears saying my CC subscription has expired, and I need to

  • Labview-Oc​tave/GNUPl​ot Inegration

    Hello, forum! I'm working on a little project to take images I've acquired using some LabVIEW code and automatically import them into GNU Octave (similar to MATLAB) and turn them into a 3D image "stack" an added bonus would bethe ability to return th

  • Can i use my computer from canada in europe?

    i'm going to a conference in paris this week. if i buy a prong adapter for the outlet in paris, will my computer convert the energy there into a useful form...and not fry my computer? thanks so much. ellen

  • What is the option on Manifest file

    Hi I have a signed applet which uses java communications api, to load this applet on to the clients machine the java extension files such as comm.jar, win32com.dll, and javax.comm.properties the jar file has to go into the lib/ext folder of the jre,