Between clause

Hi Experts,

I use the name of period in the report. period this is concatenation of month and year for example "March - 2012» In the report I m using between the clause, but it does not work very well. It takes the name of period as tank and research tank 1 by 1 and give the result.

for example if I ask the name of period is between December 2000 and January 2001 then is to show data from dec 2000-dec 2001... December 2012, jan 2001, February 2001

because it is in comparing the tank one-by-one and only reaching no not until year.

Please help me how to solve this problem. Please rply as soon as possible.

with a few assumptions and limitations - it -.
http://obiee1000.blogspot.in/2012/04/filtering-report-with-concatenated-year.html

Tags: Business Intelligence

Similar Questions

  • Relational operators without between clause

    Hello

    I have query that uses between the clause below. For certain constraints I can't use between clause so that need for convert to use only the relational operator. Please tell me what would be query.

    Select * from TABLE1 where "+ width +" between start_width ' + '.

    "and end_width and" + height + "from start_height"+ ".

    'and end_height ' +.

    «and id = «+ id»»

    Thanks,-Maury

    The BETWEEN operator includes two end points, so you just need to use ' > =' and '<='>

  • internal queries between clause

    AND bt. YEAR
    between (select year-2
    of time_table
    where is_this_year = 'Yes' and rownum = 1) - value-2009
    and
    (select the year
    of time_table
    where is_this_year = 'Yes' and rownum = 1) - value 2011

    time_table
    =========
    2011


    rather than make 2 internal requests between clause is it possible to do an article...

    Try this

    with t
    as
    (
         select year - 2 sd, year ed
            from time_table
          where is_this_year='yes'
            and rownum=1
    )
    select *
      from bt
      join t
        on bt.year between t.sd and t.ed
    
  • PL SQL conditional between clause

    I generate data based on certain criteria of dates as below:

    I need to apply the underside of the conditions in which my query clause.

    SYSDATE DATE of TRAN
    If SYSDATE = 8th monthTRAN_DATE between the 20th of the month previous , and the 7th of the month in course
    If SYSDATE = 20 of each monthTRAN_DATE between 8 current month and 19 month courses

    SELECT *
    FROM TABLE1
    WHERE TRAN_DATE ---------------------
    ;
    

    Hello

    Here's one way:

    WHERE tran_date > = CASE TO_CHAR (SYSDATE, 'DD')

    WHEN '08' THEN TRUNC (ADD_MONTHS (SYSDATE, 1))

    , 'MONTHS '.

    ) + 19

    WHEN '20' THEN TRUNC (SYSDATE

    , 'MONTHS '.

    ) + 7

    END

    AND tran_date< trunc="">

    If today is the 8th or the 20th of each month?

  • Date between Clause

    Hi all
    I have a dashboard for the date prompt(assume D_Date). I want to apply the date as xDate filter > = D_Date and YDate < = D_Date.

    Please help me I am unable to find a way to do this.

    Rahul

    Hello Rahul,

    For the column in the command prompt:

    Choose between the operator and control that the calendar. By which the user can select the date between a range value.

  • Advantage of the DELAY TO paragraph 12 c

    Hello

    I'm trying to understand the new clause PERIOD in 12 c. After reading several examples and documentation, however I'm still not sure of its advantage. What you can do PERIOD TO do that I can't reach with the help of a clause WHERE on normal start and end of time columns?

    Thank you!

    I'm trying to understand the new clause PERIOD in 12 c. After reading several examples and documentation, however I'm still not sure of its advantage. What you can do PERIOD TO do that I can't reach with the help of a clause WHERE on normal start and end of time columns?

    He can do a set much more than what you can do yourself. If she could not Oracle would not have invested a lot of time and money in it. (I'm sure they knew already had the solution of WHERE clause)

    What "several examples and documentation" are you talking about? Post links to EXACTLY what you read.

    The Oracle documentation addresses the topic well enough.

    Have you read ALL of Chapter 5, and of Information of Maintaining Time-Based Management, in the VLDB and partitioning Guide?

    http://docs.Oracle.com/CD/E16655_01/server.121/e17613/part_lifecycle.htm

    This chapter is vast and has examples of use of MUDS and same Heat Map and ADO to implement ILM.

    Have you read the 'Temporal validity Support' section in the development of database guide?

    http://docs.Oracle.com/CD/E16655_01/AppDev.121/e17620/adfns_design.htm#CACHEBFC

    Temporal validity support allows you to associate one or several dimensions of valid time at a table and have given to be visible depending on its validity, such as determined by the start and end dates or timestamps of the period for which a given record is considered valid. Examples of temporal validity are the dates of hiring and dismissal of an employee in a human resources application, the entry into force of the insurance coverage and the entry into force of a change of address for a customer or a customer.

    Support of temporal validity is generally used with Oracle Flashback technology (described in the Chapter 16), for queries that specify the valid duration in AS OF and VERSIONS BETWEEN clauses. You can also use the DBMS_FLASHBACK_ARCHIVE.ENABLE_AT_VALID_TIME procedure (described in Oracle PL/SQL packages and Types Reference) to specify an option for the visibility of the data in table: all the data table (the default), the valid data at a specific time or data currently in force within the valid time at the session level.

    Support of temporal validity is useful in Information Lifecycle Management (ILM) and any other application where it is important to know when some data becomes valid (from the point of view of the application) and when it gets invalid (if ever).

  • Function analytical to retrieve a value, a year ago.

    Hello

    I'm trying to find an analytical function to get a value on another line of research on a date with Oracle 11 g 2.

    I have a table with a date_id (truncated date), a flag and a measure. For each date, I have at least a rank (sometimes 2) is gapless.

    I would like to find analytical functions to show for each date:

    • the sum of the measure for this date
    • sum of the measure a week ago
    • sum of the measure a year ago

    As it is gapless I managed to make the week a group as in a subquery and using a SHIFT with offset to place 7 above it (see below).

    However, I'm struggling on how to do it for the data we have leap years ago. I can not simply to define the offset on 365.

    Is it possible to do with a window RANGE BETWEEN clause? I can't seem to have it work with dates.

    Week: LAG with SHIFT 7

    Violin SQL

    or

    
    create table daily_counts
    (
      date_id date,
      internal_flag number,
      measure1 number
    );
    
    
    insert into daily_counts values ('01-Jan-2013', 0, 8014);
    insert into daily_counts values ('01-Jan-2013', 1, 2);
    insert into daily_counts values ('02-Jan-2013', 0, 1300);
    insert into daily_counts values ('02-Jan-2013', 1, 37);
    insert into daily_counts values ('03-Jan-2013', 0, 19);
    insert into daily_counts values ('03-Jan-2013', 1, 14);
    insert into daily_counts values ('04-Jan-2013', 0, 3);
    insert into daily_counts values ('05-Jan-2013', 0, 0);
    insert into daily_counts values ('05-Jan-2013', 1, 1);
    insert into daily_counts values ('06-Jan-2013', 0, 0);
    insert into daily_counts values ('07-Jan-2013', 1, 3);
    insert into daily_counts values ('08-Jan-2013', 0, 33);
    insert into daily_counts values ('08-Jan-2013', 1, 9);
    
    
    commit;
    
    select
        date_id,
        total1,
        LAG(total1, 7) OVER(ORDER BY date_id) total_one_week_ago
      from
        (
          select
            date_id,
            SUM(measure1) total1
          from daily_counts
          group by date_id
      )
    order by 1;
    
    

    Year: any idea?

    I can't give an example gapless, would be too long but if there is a solution with the date directly:

    Violin SQL

    or add this to the above diagram:

    
    insert into daily_counts values ('07-Jan-2012', 0, 11);
    
    insert into daily_counts values ('07-Jan-2012', 1, 1);
    
    insert into daily_counts values ('08-Jan-2012', 1, 4);
    
    
    
    
    

    Thank you for your help.

    Floyd

    Hello

    Sorry, I; m not sure I understand the problem.

    If you are certain that there is at least 1 rank for every day, so you can be sure that the GROUP BY will produce exactly 1 row per day, and you can already use LAG (total1, 365) just as you use LAG (1, 7).

    Are you concerned of leap years?  In other words, when the day is March 1, 2016, do you want the column total_one_year_ago to reflect March 1, 2015, which was 366 days earlier?  If so, use

    date_id - ADD_MONTHS (date_id,-12)

    instead of 365.

    LAG only works with an exact number, but you can use RANGE BETWEEN with other analytical functions, such as MIN or SUM:

    SELECT DISTINCT

    date_id

    SUM (measure1) OVER (PARTITION BY date_id) AS total1

    SUM (measure1) OVER (ORDER BY date_id

    BETWEEN 7 BEFORE

    AND 7 BEFORE

    ) AS total1_one_week_ago

    SUM (measure1) OVER (ORDER BY date_id

    PRIOR TO RANGE BETWEEN 365

    AND 365 BEFORE

    ) AS total1_one_year_ago

    OF daily_counts

    ORDER BY date_id

    ;

    Again, use arithmetic dates instead of the code 365 hard, if it's a problem.

    As Hoek said, it really helps to publish exactly the results you want from the data of the given sample.  You are miles ahead of people who don't post same sample data, however.

    You just don't not to post hundreds of INSERT statements for the information of the year.  Here's a way to generate sample data for many lines at the same time:

    -Put a 0 in the table for all the days in 2012

    INSERT INTO daily_counts (date_id, measure1)

    SELECT DATE '' 2011-12-31 + LEVEL

    ,       0

    OF the double

    CONNECT BY LEVEL<=>

    ;

  • How to handle stale Stats script.

    Hello
    I use Release 10.2.0.1.0 Oracle. I have a scenario where I'm mediocre execution due to obsolete statistics plans, and how do I address the scenario. Here's the part of my main request which deviates the path of execution by the bad cardinality estimate.
     
          My column c1 of table tab1 holds javatimestamp values i.e. its NUMBER datatype which points to a date and time component only. And we gather stats each weekend on this table tab1.
          below is my query:
          
          select /*+gather_plan_statistics*/* from tab1          
          where c1 BETWEEN 1346300090668 AND 1346325539486    ;      
    
    Plan hash value: 3167980259
    
    --------------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                   | Name                    | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
    --------------------------------------------------------------------------------------------------------------------------
    |   1 |  TABLE ACCESS BY INDEX ROWID| tab1                    |      1 |   1    |    167K|00:01:13.72 |     158K|  12390 |
    |*  2 |   INDEX RANGE SCAN          | IDX_N1                  |      1 |   1    |    167K|00:00:13.27 |   13880 |   1736 |
    --------------------------------------------------------------------------------------------------------------------------
          
         Above shows a big gap in actual and estimated cardinality estimation, and its due to the fact that the HIGH_VALUE (1346203206173 points to 8/29/2012 1:20:06 AM) in DBA_TAB_COLUMN for     column C1 is well below  the STARTRANGE(1346300090668 points to 8/30/2012 4:14:51 AM) and ENDRANGE(1346325539486 points to 8/30/2012 11:18:59 AM) of the BETWEEN clause. 
         
         So even gathering stats daily on the table wont help me as because, in morning again it will require updated maxvalue for the column C1 for estimating proper, So how to handle this situation?  Dont want to go with 'hint' , want to make the stats proper so that optimizer will automatically pick the right path.
    Published by: 930254 on August 30, 2012 04:41

    930254 wrote:
    Yes, I think that of the two options as

    1. setting the High_value (high_value + 7 days ahead) in weekend work which is used to gather statistics on that table.
    2. addition of indication to follow the optimal path.

    y at - it of the other alternatives for this scenario? If this isn't the case, which will be advised of the option above?

    Published by: 930254 on August 30, 2012 06:46

    If you consider the Doms tips as well, theres "a piece of work, you need to make sure that the optimizer always uses the index that it could not properly high_value far out of reach since the last gathering"

    What is the best way to do it? Although you seem reluctant to do it, for me, it's the index indicator. You know that the index, it's what you want to use, it's a small change. All the others, although not terrible difficult to implement, need additional jobs in

  • Using conditional cards

    Hi all, I am using FDM 11.1.2.1

    I want to use a conditional mapping for personal 2 (UD2)

    I tried to use the example in the manual, but on the scope of the definition of the rule, which is empty on the example, FDM is forcing me to include a value, so, basically, that the grid is as follows

    Rule, rule name Desc rule definition Targe Custom2 Script
    All #Script NIT all -.

    And the script goes like this

    If Len (varValues (21)) > 9 and then
    Result = Left (varValues (21), 9)
    On the other
    Result = varValues (21)
    End If

    Once I execute import, the tracking error comes up

    ERROR:
    Code............................................. 4026
    Description... Not valid between Clause: (all) for card size (UD2) and rule (NIT)
    Process... clsCalcEngine.fFlagWildcard
    The component... upsWObjectsDM
    Version.......................................... 1112
    Thread........................................... 11124

    I can´t understand what is the problem with the rule, if it is on the script or the grid.

    Please any help will be very apprecited

    If you want the card to apply to all Custom2s, so I think it is more appropriate to use as mapping instead of mapping. In the mapping of input, the Def rule had to be on * (asterisk) and the target must be set to #SCRIPT.

    Published by: Larry R on November 23, 2011 12:30

  • Packets exported 11 g, but when I import on 12 c error of ' the target 11.2.0.3.0 database is an older version of the 12.1.0.1.0 source. Thus the storage clause is ignored to avoid problems of incompatibility between the versions. »

    Packets exported 11 g, but when I import on 12 c having error of ' The 11.2.0.3.0 target database is an older version of the 12.1.0.1.0 source. Thus the storage clause is ignored to avoid problems of incompatibility between the versions. »

    When I export only 1 package and then import, then I have no error and imported successfully, but when I do bulk above mention error comes.


    How can you make with the help of the SQL Developer or query?


    Kind regards.

    The problem is solved since
    Impdp iris/tpstps@PCMS full = Y dumpfile INCLUDE PACKAGE VERSION = 11.2.0.3.0 = packagespcmsTWO.dmp =
    query

  • Use a where clause clause if there is a relationship between two tables

    Is it possible to use a where clause clause if there is a relationship between two tables.
    I have a relationship between two tables:
    And a.customer = b.customer (+)

    If b.customer exists in a.customer I would add this in where clause
    And b.info = 'X '.
    But how?

    It's the outer joins by chance?

    If so, why not just:

    and  b.customer(+) = a.customer
    and  b.info(+) = 'X'
    

    BTW, I put the two "b" on the left column to make it easier to read. Some people mix that makes me crazy, but makes no difference to the query.

  • Range between unbounded preceding: default value of the windowing clause: question

    from online article down: https://oracle-base.com/articles/misc/analytic-functions

    question relates to the part I have in bold below.

    image.png

    There are two things to note here.

    • The addition of the order_by_clause without a windowing_clause means that the query is now return an average race.
    • The default value for windowing_clause is "RANGE BETWEEN UNBOUNDED PRECEDING AND LINE CURRENT", not "ROWS BETWEEN UNBOUNDED PRECEDING AND LINE CURRENT. The fact that it is the BEACH means no LINES, it stops at the first occurrence of the value of the current row, even if it's several lines earlier. Accordingly, the duplicated lines are included in the average when the value of the wage. You can see in the two last records of the 20 Department and the records of the second and the third Department 30



    He mentions including duplicates if the salary is changed. I do not notice a salary in duplicates to change the display of the output, not in salary or individual pay on average (last two documents of the Department 20 for example, both treatments show 3000 respectively). Could someone please clarify this part of the article says it all.



    Watched again and I think I understand...

    Display duplicate is included only once in the average running not twice. What is he trying to tell me?

    I think it is correct but would not rather a bad assumption.

    AVG is not a good example. Just use count:

    SQL > select empno,.

    2 deptno,

    3 sal,

    4 count (*) on rows_cnt (partition by deptno stopped by rows of sal between prior 0 and 0 preceding).

    5 count (*) on range_cnt (partition by deptno arrested by sal ranged from 0 preceding and 0 preceding)

    6 of PEM

    7.

    EMPNO DEPTNO SAL ROWS_CNT RANGE_CNT

    ---------- ---------- ---------- ---------- ----------

    7934 10 1300 1 1

    7782 10 2450 1 1

    7839 10 5000 1 1

    7369 20 800 1 1

    7876 20 1100 1 1

    7566 20 2975 1 1

    7788 20 3000 1 2

    7902 20 3000 1 2

    7900 30 950 1 1

    7654 30 1250 1 2

    7521 30 1250 1 2

    EMPNO DEPTNO SAL ROWS_CNT RANGE_CNT

    ---------- ---------- ---------- ---------- ----------

    7844 30 1500 1 1

    7499 30 1600 1 1

    7698 30 2850 1 1

    14 selected lines.

    SQL >

    We hope now that you see the difference.

    SY.

  • between the clause of

    I have a question where I get the data from a range of dates

    Select * from test_table where test_date between date1 and date2

    The query will give record set between date1 and date2.

    Now say date2 is null, in this case, I need to get all the records with test_date > = date1 as there is no limit on the date2.

    I don't want to use dynamic SQL to do this, now how it can be done?

    AB

    Hi, Ab,

    Here's one way:

    Select *.

    from test_table

    where test_date between date1

    and NVL (date2

    test_date

    )

    ;

    and another:

    Select *.

    from test_table

    where test_date > = date1

    and (test_date<=>

    Date2 IS NULL OR

    )

    ;

  • type mismatch between cursor fetch and into clause

    Hi all
    Let us, considering what follows in the 11g:
    create table TEST1
    (
      ID   NUMBER(38),
      COL1 NUMBER(38)
    )
    tablespace USERS
      pctfree 10
      initrans 1
      maxtrans 255;
    CREATE OR REPLACE TYPE t_test IS OBJECT
    (
       id NUMBER(38),
       col1 NUMBER(38)
    )
    ;
    CREATE OR REPLACE TYPE t_test_table IS TABLE OF t_test
    and...

    declare
    
    cursor c is select 10 as id, 20 as col1 from dual connect by level < 1000;
    
    v_data t_test_table;
    
    begin
      
    
    open c;
    loop
      fetch c bulk collect into v_data limit 100;
      
      
      forall i in 1..v_data.count
        insert /*+ append_values */ 
        into test1 
        values(v_data(i).id, v_data(i).col1);
        
      exit when c%notfound;  
    
    end loop;
    close c;
    
    end;
    When we execute the statement we received the error:
    ORA-06550: line 13, column 29:
    PLS-00386: type mismatch found at 'V_DATA' between FETCH cursor and INTO variables
    ORA-06550: line 13, column 3:
    PL/SQL: SQL Statement ignored
    I know that a possibility here is to change the V_DATA type as being the rowtype cursor... consider that I want to use the v_data data after a DML operations in other / something like cast iron table process.


    Any ideas?


    Thanks in advance,
    Alexander.

    Could you remove the indication (append_values) and see?

  • between the clause of sql query?

    Hi all

    After sql query using a report.
    ------------------------------------------------

    Select trunc (m.spc_doc_date) prod_date, sum (nvl(d.req_qty,0)) order_qty, sum (nvl(d.spc_item_qty,0)) prod_qty
    of spc_ppc_daily_m m, spc_ppc_daily_d d
    where m.spc_doc_ # in (select spc_doc_ # to spc_ppc_daily_m)
    - and d.blce_qty > 0
    and m.spc_locn_code =: locn_code
    and m.spc_doc_date between: TO_date and: FROM_date
    and m.spc_locn_code = d.spc_locn_code
    and m.spc_doc_ #= d.spc_doc_ #.
    and (m.obu =: obu OR: OLGA IS NULL)
    and (m.customer =: customer OR: CUSTOMER IS NULL)
    Trunc Group (m.spc_doc_date)
    order of trunc (m.spc_doc_date)

    -----------------------------------------

    "When I use to_date = 22 February 2012 ' from_date = February 22, 2012"
    There is no pick up. (acually documents are there on February 22, 2012)

    "When I use to_date = 22 February 2012 ' from_date = February 23, 2012"
    now shows data of February 22, 2012.

    I have replace between it of > = & < =, same result two cases respectively.

    Why?

    Thank you
    Yoann

    date you hours minutes and seconds
    then

    use
    trunc (m.spc_doc_date)

    or to: from_date in the parameter after form convert to February 23, 2012 23:59:59 '

Maybe you are looking for