using the loop in matrix report

Dear all,

I want to generate a turnout report.the user will enter just the start_date and the end_date.
Suppose that the days between arguments start_date and the end_date are 30 days.i want to use those 30 days for the columns in the matrix report.i use the following loop.

because loop me in 1.30
(I) return;
end loop;


She just return 1 for each column as
1 1 1 1 1 1 1... and so on
Instead, I want it to appear
1 2 3 4 5 6 7 8 9 10... and so on until 30.

How would I do that?

Thank you and best regards.

Lets say that emp 1 was late 03 - Jan, emp 2 was absent on 04-Jan and emp 4 was behind on 07 - Jan. And if you run the report from Jan 01 - Jan - 10, it should give dates of Jan. 01 - Jan to 10. You can use the query like this (this is just an example, you must change according to your requirement. The part that provide daily, you can use as it is):



SELECT EMP_LATE_ABSENT.EMPNO,
TO_CHAR(ALL_DATES.ALL_DAYS,'DD') ALL_DAYS,
EMP_LATE_ABSENT.HOURS_LATE
FROM

(
SELECT ALL_DAYS
FROM (
SELECT TO_DATE(:start_date,'DD-MON-RR') + LEVEL - 1 ALL_DAYS
FROM dual
CONNECT BY LEVEL <= TO_DATE(:end_date, 'DD-MON-RR') - TO_DATE(:start_date,'DD-MON-RR') + 1
)
) ALL_DATES,
(
SELECT 1 EMPNO,
TO_DATE('03-JAN-2009') DATE_LATE_ABSENT,
3 HOURS_LATE
FROM DUAL
UNION
SELECT 2,
TO_DATE('04-JAN-2009'),
NULL
FROM DUAL
UNION
SELECT 4,
TO_DATE('07-JAN-2009'),
6
FROM DUAL
) EMP_LATE_ABSENT
WHERE ALL_DATES.ALL_DAYS = EMP_LATE_ABSENT.DATE_LATE_ABSENT(+)
ORDER BY EMP_LATE_ABSENT.EMPNO,
ALL_DAYS

So result would come up like this:

Emp All Days Hours Late
1 03 3
2 04
4 07 6
01
02
05
06
08
09
10


And when you create a matrix report, from 01 to 10 days would be in the form of columns, used as lines and values of hours/null as cell values.

I hope this helps.

Tags: Oracle Development

Similar Questions

  • An associative array, how the records using the loop counter?

    In the associative array, how the records using the loop counter? for example
    declare
        type population is table of number index by varchar2(64);
        city_population population;   
    begin
        city_population('Samillve') := 200;
        city_population('Lindenhurst') := 300;    
        
        for i in 1 .. city_population.count
        loop
            dbms_output.put_line(city_population(i)); -- compiler error
        end loop;
    end;
    /

    That would look like

    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2      type population is table of number index by varchar2(64);
      3      city_population population;
      4      l_index varchar2(64);
      5  begin
      6      city_population('Samillve') := 200;
      7      city_population('Lindenhurst') := 300;
      8      l_index := city_population.first;
      9      while( l_index IS NOT NULL )
     10      loop
     11          dbms_output.put_line(city_population(l_index ));
     12          l_index := city_population.next(l_index);
     13      end loop;
     14* end;
    SQL> /
    300
    200
    
    PL/SQL procedure successfully completed.
    

    Justin

  • Using the loop will decrease performance

    Hello
    Using the loop with a query will decrease performance.

    for r_row in (select * from table) Loop
    end of loop.

    This is done within another loop for, more cases, it returns a single value.
    It will decrease the performance of the procedure.
    kindly advice...

    Kind regards
    Balu

    user575682 wrote:
    Using the loop with a query will decrease performance.

    for r_row in (select * from table) Loop
    end of loop.

    This is done within another loop for, more cases, it returns a single value.
    It will decrease the performance of the procedure.

    Perhaps better understand everything that makes this PL/SQL loop construction.

    PL/SQL is two languages. It's PL (logic programming code) like Pascal, C or Java. You can use a 2nd language in it called SQL. The PL engine will be able to recognize when the 2nd language is used. And it compiles all the things that are necessary for motor PL call the SQL engine, pass the data to the SQL engine and get back data, etc. (compare this with the complexity of the use of SQL in Pascal, C or Java language).

    So what's this loop? The PL engine recognizes the SQL SELECT statement. It creates an implicit cursor by calling the SQL engine to analyze (I hope a soft Parser), then run it.

    As part of the loop of the PL, the PL engine now calls the SQL engine to extract data (lines) of the cursor. With 10g and later, the engine of the PL is smart enough to use the implicit treatment in bulk.

    Before 10 g that he used to extract a line from the SQL engine, make the loop, the next line extraction, the loop, etc. In other words, if there is a 1000 lines to pick up, he'll call the SQL engine after 1000.

    With 10g and later he get a 100 lines, which store in a buffer internal and then make the loop once 100. With a 1000 lines to fetch, it requires 10 extractions in bulk instead of one 1000 rank of extractions.

    These extractions require a change of context - as the engine PL must not out back, and in the SQL engine to extract a line. It is an overhead projector and can become so slow the context switch nothing more.

    And it's the construction of bases for this loop (and most other cursor loops) in PL/SQL.

    The ideal is to reduce the number of context switches. It is an overload that can have an impact on performance.

    What about using a loop in a loop. As 'bad '. This example uses the outer loop to retrieve the data. These data are then used to excite the extraction in internal or nested loop. The outside loop draws data from the SQL engine in PL variables Inside loop drives that same data back to the SQL engine.

    Why? It would have been much faster not to pull and push data between the loops using PL.

    It will be much faster do so only through SQL. Write the two loops as a single SQL statement and have the SQL engine directly driving these loops itself. This is called a JOIN in SQL. And the SQL engine can do not only more quickly, but it has a few algorithms of multiplied can be used which are even faster than a nested loop process (called merge joins, hash joins, etc.).

    Bottom line. Optimize SQL. Reduce to a minimum the PL. *

    Do as much of your data, crunch in SQL as possible. SQL is the fastest 'place' and process the data. No PL (or C/Pascal/Java).

  • Insert the loop by a report or insertion using a link of the column

    Hello!

    I think I have an easy one.

    I created a site that lists 'problems' with the curriculum of the University. If a curriculum developer sees something that needs to be updated, they use this site to connect to the 'question' so we have a drop-down list of how the program has changed for the particular course or courses. Some 'problems' cover several courses, if a table has been created to allow the issue to join courses as needed.

    The 'Courses' table contains a list of all courses at University
    The 'Issue_Courses' table combines the primary key of the 'question' and the 'course' and creates the association between the questions and the courts.

    The users use of page to create the associations has a report called 'add_courses' which can be consulted and filterable so that the user can refine the list of courses they want to see (the list is well into the thousands), and this report contains a column with checkboxes. This page also contains a hidden field containing the primary key of the issue, "p13_Issue_ID."

    I would like to create an insert query that takes hold of the primary key of the issue of "p13_issue_ID", she travels around the report, by inserting a new record for each box checked in the report. Any help would be great! Certainly, my sql is pretty week.

    Another option that I think would work, if possible, to have a "link in the column" that simply runs the insertion process by entering the primary key for the problem of "p13_issue_ID" and the id of the course of the report. Then, the user could just click on a link 'Add' or something similar on the report, which would go to the insert statement and essentially create this association. Is this possible?

    Thanks in advance!

    Published by: 846852 on March 23, 2011 15:12

    Published by: 846852 on March 23, 2011 15:14

    that should have been this line

    1 IN 1.APEX_APPLICATION. G_f01. COUNTY

    I typed 1 instead of I

    To take

    BECAUSE me IN 1.APEX_APPLICATION. G_f01. COUNTY

  • Incorrect display using the loop format for

    Hello

    I have a digital painting using a hexadecimal display format that is autoindexed by a loop for. Within the loop for each unique value is passed to a Subvi needed the hexadecimal display format. Unfortunately, indexing is not keep this hex format but transfers back to a decimal number.

    No idea how to solve this problem?

    Thanks in advance and best regards

    Simon

    Thanks for this tip. The problem was an another Subvi where I created the num-array that will subsequently in the loop for., all the digital elements where the value instead of I32 I16. The controller could not handle these false values, so I got a nonsense.

    Thank you very much for your quick responses!

  • decimal to binary conversion using the loop

    How to create a LabVIEW program to convert a decimal number to binary equivalent using FOR loop?

    can someone help me please...

    Dhass, your sound question as a duty. Is this correct?

    If so, the zip code you have already so that we can identify the weak points in it.

    Tone

  • Excerpt from my table using the loop For

    Hello

    I have this loop to create a 2D array. The result is on the table below. I want that this 2D table should be fully completed and compiled, then it will be sent out of the loop.

    I don't want to extract the value of table 2D is a loop. This is the problem that I am facing.

    My ultimate goal is to extract the individual number of the final table of the 2D table line and be an entry for other functions.

    Please help me. Thank you

    PX

    Hi PX.

    Here's a solution without using screw express

  • First group title below displays under the column headers using the model 23 classic report with the help of repeat titles on break

    Hello

    I am migrating an application from 3 APEX APEX 4.2 on a thing I noticed with the classic reports when I put them in the model 23, it's that the first section break has break notch under the headings of columns for this section of line while the remaining lines properly have it display above the headers on the subsequent sections of group.


    When I look at firebug code I saw that all the tables but the first, the break line is included in the last line of the previous table, so I can see how it did not work for the holidays since.

    I have tow questions.

    1. is it really intentional because it seems not terribly elegant and my users to zero immediately above as a perceived bug.

    2. is there a reasonable job around always use headers repeat on break? I have multiple reports on the same page in places so switch to interactive reports is not a quick fix for me in this case.

    Example of a question can be seen at apex.oracle.com at home

    Thank you

    Brad

    Roadling wrote:

    Hello

    I am migrating an application from 3 APEX APEX 4.2 on a thing I noticed with the classic reports when I put them in the model 23, it's that the first section break has break notch under the headings of columns for this section of line while the remaining lines properly have it display above the headers on the subsequent sections of group.

    1. is it really intentional because it seems not terribly elegant and my users to zero immediately above as a perceived bug.

    The Standard report template definition in issue 23 contains thead and tbody elements:

    Before the column header

    
    

    Column title template

    #COLUMN_HEADER#
    

    After the title column

    
    
    

    After the lines

    
    
    
    
    
    
    #PAGINATION#
    
    
    
    

    This is intentional, the best practice for marking up HTML tables. What is not expected is the problem that arises when this model is used with the break of repeat titles on break formatting option. The repeated headings result table consisting of soup of tags containing several poorly constructed tbody and thead, which is not valid elements.

    2. is there a reasonable job around always use headers repeat on break? I have multiple reports on the same page in places so switch to interactive reports is not a quick fix for me in this case.

    Create a copy of the report model Standard in Standard (break formatting) for use with reports of the break, remove the thead and tbody definitions of template tags and the breakdown of the reports to use the new model of change. (Or, if you use mainly break reports using the Standard template, keep the tags in the copy and remove them from the original in order to minimize the number of reports, you need to change.)

    Personally, I would create a report model of line custom to break complex reports in order to be able to have complete control over the structure and presentation.

  • Using the loop

    Hi all

    I have two VO... IE, VO1 and VO2. and I have a handful of two your

    I want to compare attribute VO1 VO2 attribute... both have guess that 4 attributes.

    what I want to do here is: first of all I want to compare all 4 attributess VO1 1 rank to all the 4 attributes of 1st row of VO2. If they're all matches then the 5th value of attribute attribute value VO1 VO2 5th.

    If the 1st rank of VO1 is not with the 1st rank of VO2 then compare VO1 1 rank 2nd in the VO2... and so on...

    If the match then set value and exit that loop... and yet once compare with 2nd row of VO1 1st row of VO2...

    How can I do this... can I use 2 loops?

    loop external and inner loop?

    If Yes, then how can I extract the data of both your and how I can compare their attributes?

    Thank you...

    Hello

    Yes... you can do using two Do While loops. using vo.next.

    Please find the below generic example code.

    OAViewObject dbVo = (OAViewObject) oaapplicationmodule.findViewObject ("SimpleSearchVO");

    Line line = null;

    dbVo.reset ();

    do

    {

    line = dbVo.next ();

    if(Row == null)

    {

    break;

    }

    Line row2 = dbVo.getCurrentRow ();

    String newprice = String.valueOf (row2.getAttribute (viewAttributeName))

    } while (true);

    Thank you

    Bharat

  • Build the value of 100 mb of data in the table using the loop

    DB version: 11.2

    How can I create about 100 MB of test data in a table using minum number of records.
    If I use the below for loop. It takes 100,000 records to fill only 2 MB.
    SQL> create table a2 (mynum1 number, mynum2 number);
    
    Table created.
    
    begin
    for i in 1..100000 loop
        insert into a2 values(i,i*2);
    end loop;
    end;
    
    
    select segment_name, bytes/1024/1024 MB from dba_segments where segment_name = 'A2' AND owner='SCOTT'
    
    
    SEGMENT  BYTES/1024/1024
    -------- ---------------
    A2                     2

    Hello

    Is that what you are looking for?

    SQL> CREATE TABLE tbl1(c1 CHAR(1024));  -- ~1KB per row
    
    Table created.
    
    Elapsed: 00:00:00.00
    SQL> INSERT /*+ APPEND */ INTO tbl1 SELECT 'X' FROM dual CONNECT BY LEVEL < 100000; -- 100K rows * 1KB = 100MB + some additional overhead
    
    99999 rows created.
    
    Elapsed: 00:00:13.02
    SQL> SELECT bytes/1024/1024 MB FROM user_segments WHERE segment_name = 'TBL1';
    
            MB
    ----------
        113.75
    

    Lukasz

  • How to use the loop in BPEL process

    Hi friends

    I did a bpel process that picks up the XMl file using the File adapter and imports the data from the XMl file into db oracle table using the DB adapter...

    But here the XML in the file that have only one line... If I want to insert the XML code in the file that have two or more lines I want to use a loop in my process BPEL how to use loop in my bpel process?

    In my BPEL process, that I have que j' ai utilise used receive, process and call activity where I can use in my BPEL process

    Thanks in advance

    AT

    Here is a basic example of while activity in BPEL

    http://blogs.Oracle.com/ajaysharma/

    Thank you
    AJ

  • Reading data from a Table by using the loop

    I have a dynamic array within the PDF form. I want to loop through the rows in the table and read the contents of the cell. I successfully get the number of rows in the table. But impossible to read the values in the cells. I put control TextField (txtName) editable in every cell and trying to read its value.

    screenshot is below.

    table_loop_error.jpg

    I use the code is:

     form1.Page1.Subform1.btnReadTable::click - (JavaScript, client)
    
    var rowCount = MyTable._Row1.count;
    app.alert("Row Count: " + rowCount);
    var i = 0;
    
    for(i=0 ; i<rowCount ; i++)
    {
        //app.alert(MyTable.Row1[i].txtName.rawValue); // NOT WORKING
        
        app.alert(MyTable.Row1.txtName.rawValue); // WORKING, But just giving the value for the first row.
    }
    

    Please tell me how can I get the value of each name in all ranks by making a loop.

    Thanks in advance.

    -

    Afonso

    Hi, Afonso,

    You must resolve the node for the particular case of i. The syntax is:

    xfa.resolveNode("MyTable.Row1[" + i  + "].txtName").rawValue;
    

    Here there is an example that will show you the loop in action:

    http://www.assuredynamics.com/index.php/category/portfolio/two-way-binding-in-tables/

    Hope that helps,

    Niall

    Ensure the dynamics

  • AS2.0 using the loop

    It's been a while for me, I use to know AS2.0 very well, but far from him, I've traveled (mostly do PHP, Java, c#, VB now), but I'm back in the flash thing and I need help to dynamically create a variable name to work with. I remember I use to know how to do it, but alas, my knowledge is gone.

    Question: I have a few video clips with some unique identifies within each of them, that I need to access it in a loop for example.:

    myMovieClip01_mc
    myMovieClip02_mc
    myMovieClip03_mc
    ... etc.

    So basically I write a loop for which will allow me to access each in the loop for I thought to rewrite the program with a table, but it's a lot of code.

    Thus, each loop I need to create something like this:

    "myMovieClip" + (i + 1) + "_mc".

    Please to jog my memory on this subject. Thank you very much.

    of course - you must use the operator to access here, as in:

    This ["myMovieClip" + (i + 1) + "_mc"].

  • Can we use the output of a report as input for the other report?

    Dear all,

    I would like to know if we have an OBIEE option where we can save the output of a report and use it as a filter for another report?

    My scenario is similar to:

    (1) I have a report on ORDERS which gave me 250 orders.

    (2) I want to have a report on the table of the SHIPPING for these 250 commands.

    Can I save the result of the report 1 as a filter and use it in 2nd report?


    Please notify.

    Thank you
    Suma

    Hello

    Using the tab filters like filter based on another demand peak we can achieve

    Concerning

    NGO

  • How to use the loop to commit every 1 M folders?

    Oracle 9i
    40 M records must be insert the table. You will need to validate every 1 M. But I don't want to loop every recording and validation. I like select commit and records of 1 m and then select another 1 M, then validation; How to do? use the save point?

    Appreciate any ideas.
    Thank you
    S.

    You can perform this anonymous help block by using a loop and listen but it not a good idea to commit after 1 million or 100 k you put more load on your system and the performance will be declining.

    Concerning

Maybe you are looking for