Report of multiple tables - tired two

Hello

I am creating a report containing data from two tables in the Apex, similar to that with a record header followed by the details records. The result would be similar to the output that would come from the following statement. Do you know if this is possible? Could you please help with the process to create this. Thank you.

SET SERVEROUTPUT ON
DECLARE
BEGIN
FOR rec IN (select SEQ_MAJ_GOALS as SEQ_MAJ_GOALS from MAJOR_GOALS where EMP_NO =: EMPNO and r_status = 'Open')
LOOP
DBMS_OUTPUT. PUT_LINE ('SEQ_MAJ_GOALS');
DBMS_OUTPUT. Put_line (CRE. SEQ_MAJ_GOALS);
FOR tasks IN (select TASK_DESC, LEAD_REQ, TASK_NO, TASK_STATUS of TASKS where SEQ_MAJ_GOALS = REC SEQ_MAJ_GOALS)
LOOP
DBMS_OUTPUT. Put_line (rpad (ltrim (tasks. (TASK_NO), 11). RPAD (ltrim (tasks. (TASK_DESC), 30). RPAD (ltrim (tasks. (LEAD_REQ), 20). RPAD (ltrim (tasks. (TASK_STATUS), 10). 10;
END LOOP;
END LOOP;
END;

I do this using a PL/SQL area and use of the htp.p ('');

An example:

Create a procedure and DECLARE a cursor with variables for each value of the slider. In the BEGIN section to create your loop, use the slider to fill the variables, and then use the htp.p call to create your own output array.

It might look like this:

declare
  cursor c_rec is select SEQ_MAJ_GOALS
           from MAJOR_GOALS where EMP_NO = :EMPNO and r_status = 'Open';
  v_goals    NUMBER;
  cursor c_task is select TASK_NO, TASK_DESC, LEAD_REQ, TASK_STATUS
           from TASKS where SEQ_MAJ_GOALS = v_goals;
  v_taskno  NUMBER;
  v_taskdesc  VARCHAR2(255);
  v_leadreq    VARCHAR2(42);
  v_taskstatus  VARCHAR2(20);
begin
  htp.p('');
  open c_rec;
    LOOP
      FETCH c_rec into v_goals;
      EXIT WHEN c_rec%NOTFOUND;
        htp.p('');
        htp.p('');
        open c_task;
          LOOP
            FETCH c_task into v_taskno, v_taskdesc, v_leadreq, v_taskstatus;
            EXIT WHEN c_task%NOTFOUND;
              htp.p('');
          END LOOP;
      close c_task;
    END LOOP;
  close c_rec;
  htp.p('
SEQ_MAJ_GOALS
'||v_goals||'
'||v_taskno||''||v_taskdesc||''||v_leadreq||''||v_taskstatus||'
'); end;

You can add your own styles and formatting.

Tags: Database

Similar Questions

  • To create an interactive report in the apex by selecting from multiple tables

    Hi, I am creating an interactive report by selecting from multiple tables.

    SELECT w.FIRST_NAME as name, w.SURNAME as name, i.ROAD Road, i.DATE_OF_INC as DATE_OF_INC, S.STATEMENT as a STATEMENT OF Declaration

    JOIN THE

    WITNESS w

    ON w.witness_id = s.FK1_WITNESS_ID

    JOIN THE

    Incident I have

    WE

    i.incident_no = w.FK1_INCIDENT_NO

    JOIN THE

    user_station ps

    ON ps.station_id = i.nearest_station_id

    JOIN THE

    the user in.

    WE

    in. STATION_ID = ps.station_id

    WHERE po.officer_id = 1

    by I continue to encounter this error "the report query requires a unique key to identify each row. The supplied key cannot be used for this query. Please change the report attributes to define a unique key column. "ORA-01445: cannot select ROWID from where sample, a join without key preserved table view '

    So I googled around and found that in the attibutres tables report, I need to change the "LINK" COLUMN so first, I changed "Link to custom target", but the report is so I changed it to "Exclude link Clolumn" again, the report didn't report and I STILL got a blank page with only the tabs.

    I wonder you can not create a report by selecting from multiple tables?

    If you can please I need your help.

    Thank you

    You can, but in this case, it might be easier to build your report tables that are joined Oracle views and then build your report out of the newly built sight...

    Or wrap a selection around your selection with joins, and then make the where clause on the external selection...

    Thank you

    Tony Miller
    Software LuvMuffin
    Ruckersville, WILL

  • Create view opaque in OBIEE with multiple tables

    Hello

    I need assistance with the opaque view since I've never created in the past. I want to create an opaque view that retrieves data from several tables. Is it possible to do? Or y at - it another alternative available in OBIEE option? I read the blog following and other similar articles on views opaque but found no option to use for the query with several tables:

    Oracle Business Intelligence: A physical layer to OBIEE 10 g Opaque View Creation


    Also please advice how to join two tables from different databases in OBIEE?


    Kindly advice.


    Kind regards

    Andy

    Check also, it may be useful to you

    http://obinsight.blogspot.com/2010/05/reporting-against-multiple.html

  • Update multiple columns from multiple tables in a single UPDATE request

    Hello

    I'm trying to figure if I'm heading in the right direction.

    I want to update multiple columns from multiple tables in a single UPDATE request. Also, I would like to update multiple columns in a table from the tables.

    Scenario 1

    UPDATE Table2, Table 3
    SET T2.Column1 = T1.Column1 
    ,T2.Column2 = T1.Column2
    ,T3.Column2 = T1.Column2
    FROM Table1 T1, Table2 T2, Table3 T3
    WHERE T1.id = T2.id
    and T1.id = T3.id
    
    

    Scenario 2

    UPDATE Table3
    SET T3.Column1 = T1.Column1 
    T3.Column2 = T1.Column2
    ,T3.Column3 = T2.Column3
    ,T3.Column4 = T2.Column4
    FROM Table1 T1, Table2 T2, Table3 T3
    WHERE T3.id = T1.id
    and T3.id = T2.id
    
    

    Hello

    For scenario 1, you must write separate instructions UPDATE table2 and table3.

    To guard against someone else change one of these tables while you act so you can copy all relevant data in a global temporary table and update this global temporary table table3.

    ENGAGE only when two tables have been changed.

    You can write a procedure or an INSTEAD OF trigger to do all this.

    For scenario 2, you can reference many tables that you need when new table3.  It might be more efficient and simpler to use the MERGER rather than UPDATED.  For example:

    MERGE INTO table3 dst

    WITH THE HELP OF)

    SELECT t1.id

    t1.column1

    t1.column2

    t2.column3

    t2.column4

    FROM table1 t1

    JOIN table2 t2 ON t1.id = t2.id

    )             src

    WE (dst.id = src_id

    WHEN MATCHED THEN UPDATE

    SET dst.column1 = src.column1

    dst.column2 = src.column2,

    dst.column3 = src.column3,

    dst.column4 = src.column4,

    ;

  • Comparing the same tables of two schemas

    I had already posted a similair on this thread. So, I thought I would start a new thread on this to avoid confusion

    I want to generate a report that shows the difference in the data type of the columns in the same table in two different patterns.

    The query using LESS shows the difference below.

    create table SCOTT.mytab1 (empid number);
    create table HR.mytab1 (empid varchar2(34));
    
    
    SELECT   table_name, column_name, OWNER schema, data_type
    FROM     dba_tab_cols where owner = 'SCOTT'
    AND TABLE_NAME = 'MYTAB1'
    MINUS
    SELECT   table_name, column_name, OWNER schema, data_type
    FROM     dba_tab_cols where owner = 'HR'
    AND TABLE_NAME = 'MYTAB1'
    
    Result:
    TABLE_NAME      COLUMN_NAME     SCHEMA     DATA_TYPE
    --------------- --------------- ---------- ------------
    MYTAB1          EMPID           SCOTT      NUMBER
    But, since it is a report, I want to see the form of results the two schemas that has column of different data types with the same names of table

    Expected results:
    TABLE_NAME      COLUMN_NAME     SCHEMA     DATA_TYPE
    --------------- --------------- ---------- ------------
    MYTAB1          EMPID           SCOTT      NUMBER
    MYTAB1          EMPID           HR         VARCHAR2
    Anyway I could do this?

    Why not get a single line with two types of data:

    select a.table_name, a.column_name, a.data_type schema1_type, b.data_type schema2_type
    from all_tab_columns a, all_tab_columns b
    where a.owner = 'SCOTT'
    and b.owner = 'HR'
    and a.table_name=b.table_name
    and a.column_name=b.column_name
    and a.data_type!=b.data_type;
    

    This extracted single query columns present on the two schemas but with different data types. These columns only on one of the two schemas are not extracted.

    Max

  • Report option box table

    Hello

    I have a table with two columns: NAME and PRIMARY

    One name must match the primary name (PRIMARY = 'Y') all others are secondary (PRIMARY = 'n').

    I've created a report updated on the table and it works very well... except for the field PRIMARY returns as text boxes, so there is nothing (to the surface) to stop a user try to put two names with PRIMARY = Y.

    A great way to get around this would be to have this show as a radio button field wherever a single line in the report can be selected.

    Is it possible and if yes, can you give me a pointer in the right direction to make it work?

    Thank you

    Joseph

    Hi Joseph,.

    Take a look on Re: create a Yes / No and then YES, another STEP in the table... If selected radiogroup -it details the steps to select a main employee on [http://htmldb.oracle.com/pls/otn/f?p=55041:18]

    And this does not use the radiogroup feature - so, good choice!

    Andy

  • How can I build a table using two digital controls and a button? Whenever I press the button, a column of 2 lines (digital orders) should be created.

    I tried several ways to date.

    I know that I can use the building to create a table of two numbers but I am not able to create a 2d in this way

    I also tried to use Replace subset of table, but still it won't work.

    I know that I have to use a table that has the index of the column starting with 0, so whenever I press the button of the column index incriments by 1 so the next column will change but I am not able to create this.

    You are the authority on what a Altenbach! He writes, I just did to make it work. Don't really consider this. Here's a modified version for the OP to use should he like:

  • Use with need to collect in bulk to insert records from multiple tables

    Hello

    I plsql record type with several tables with multiple columns. so when I used bulk collect with education for ALL. I want to insert records in multiple tables.

    Please give me suggestions.

    ForAll is designed to be used with a single DML statement, which may include dynamic SQL statements. However, I do not know what advantage this will give you your list iteration save several times, one for each table - especially since there is an air show with SQL dynamic.

    Example 1 (dynamic SQL):

    begin

      ...

      forall i in vRecList.First..vRecList.Last
        execute immediate '
        begin
          insert into Table1 (Col1, Col2, Col3) values (:1, :2, :3);
          insert into Table2 (Col1, Col2, Col3) values (:1, :2, :3);
        end;' using vRecList(i).Col1, vRecList(i).Col2, vRecList(i).Col3;
    end;

    Another approach that I should work (but not tested) is using to insert all the Scriptures and based record inserts, but you need to try on your version of Oracle forall has changed between the versions.  In this case vRecList must be compatible with the Table % ROWTYPE and Table2% ROWTYPE type.


    Example 2 (insert all):

    begin

      ...

      forall i in vRecList.First..vRecList.Last

        insert all

          into Table1 values vRecList(i)
          into Table2 values vRecList(i)
        select 1 from dual;

    end;

  • Can break us af:table in two columns as panelformlayout display?

    Mr President.

    Can break us af:table in two columns as panelformlayout display?

    Concerning

    And the two group must be vertical, m I right?

    you want to like this-

    Column1 Column2 Column3

    column4 column 5 column6


    You can't do that with an af:table that you can do is remove two tables same viewObject, sharing the same iterator and take a few columns in the first table years based in the second table and then surround the two tables with a layout of the Panel group (vertical)

    or take a look at the id of the pivot table, it fits in your case.

    http://docs.Oracle.com/CD/E12839_01/Web.1111/b31973/dv_crosstab.htm#ADFUI3073

    Ashish

  • Multiple Table join result problem

    Hello

    I am new to oracle

    I am facing a problem to the exact result of multiple table.
    My query is


    Select e . e_name, t . Start_date, a. area_name , t . Branch of the , t . objective, ( t. actual_rtn_dt - t . Start_date) duration

    t of tour_info zone a, e method

    where actual_rtn_dt is not null

    and t. emp_code = e. emp_code

         and t. zone = a. Area_Code

    order t. start_date;

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

    Here is the result

    MD. KHAIRUL ISLAM01 SEP-14DHAKA_3071AUTOMATION6
    DEV SUDORSON02-SEP-14TRAINING DIISP2
    JUSTINE DIA04 SEP-14GAZIPURHUMAN RESOURCES REVIEW0
    SABRI AL RAHMAN04 SEP-14DHAKA_3071AUTOMATION WITH PKSF3
    MD. KHALEDUL ISLAM04 SEP-14GAZIPURHUMAN RESOURCES REVIEW0
    GAZI MD. SALAHUDDIN04 SEP-14GAZIPUR0
    MD. KHALEDUL ISLAM06 SEP-14071AUTOMATION0
    MD. JULIEE RAHMAN14-SEPT-11GAZIPURTRAINING2

    But I want to, in Bracnh column allows to extract branch_name Bracnh Tbal (I have on the database) as Area_name.

    How is it Possible?

    Thanks advanced

    SELECT e.e_name,
           t.start_date,
           a.area_name,
           --t.branch,
           (select branch_name from branch_tbl where =t.branch) branch_name,
           t.objective,
           ( t.actual_rtn_dt - t.start_date ) duration
    FROM   tour_info t,
           area a,
           emp_info e
    WHERE  actual_rtn_dt IS NOT NULL
           AND t.emp_code = e.emp_code
           AND t.area = a.area_code(+)
    ORDER  BY t.start_date;
    

    Is that what you are looking for?

  • Select Max (date) between multiple tables

    I need to retrieve a record from a Table in a set of similar tables with a common "date field". You can select the record where this "date field" value is greater between multiple tables.

    Here, any help is appreciated.  Thank you in advance.

    FOR EXAMPLE

    No. EMP is the primary key.

    Again, each table can have multiple records for EMP n ° 1

    TABLE1:

    FIRST NAME

    FAMILY NAME
    THE EMP NO.

    BASE SALARY

    DATE_FROM

    TABLE 2

    FIRST NAME

    FAMILY NAME
    THE EMP NO.

    SALARY GRADE

    DATE_FROM

    TABLE 3

    FIRST NAME

    FAMILY NAME
    THE EMP NO.

    COMPENSATION

    DATE_FROM

    Hello

    Said Knani, if you use the current design of the table, then here is a way to do what you want:

    WITH union_data AS

    (

    SELECT MAX (base_salary) AS sal FROM table1 UNION ALL

    SELECT MAX (grade_salary) table2 UNION ALL

    SELECT MAX (compensation) FROM table3

    )

    SELECT MAX (sal) AS max_sal

    Of union_data

    ;

  • Reports on multiple virtual centers and export to CSV format

    Everyone,

    Does anyone know if possible a way for me to do the following in the following format.

    Requirements:

    (1) report on multiple virtual centers

    (2) export results to CSV or Excel with a title between each virtual Center

    (3) the need for Virtual Center Cluster belongs, name of the Cluster, host number of ESX and number of virtual machines. (Additional information can be added to the report later).

    It would be not so hard if I could just connect and report on all virtual centers and my results to export in this way.  However, each virtual server Center have a different purpose and that is how senior management wants to see the results.

    For example:

    VC3 VC1 and VC2 = service server environment

    VC4 and VC5 VC6 = service Workstation environments

    VC7 VC8 = environment of Cloud Computing Services

    What I would do is:

    (1) connect to the first 3 virtual centers and collect the above information.

    (2) I would like to create a title in the CSV or Excel named 'Standard Server environment summary'

    (3) then I would like to export these 4 columns with data for each cluster.

    Cluster is managed by this Virtual Center, the name of the Cluster, number # VM and ESX host

    I then unplug the 3 first virtual centres.

    Next

    (1) I would like to connect to the 3 next virtual centres

    2) add to the previous CSV or Excel with a title 'desktop environment summary.

    (3) export the same information as above in the CSV file

    Any help would be greatly appreciated.

    Try something like this

    $vcenters = @{}
    $vcenters["Server Environment"] = @("VC1","VC2","VC3")
    $vcenters["Workstation Environment"] = @("VC4","VC5","VC6")
    $vcenters["Cloud Environment"] = @("VC7","VC8")
    
    Set-PowerCLIConfiguration -DefaultVIServerMode Single -Confirm:$false | Out-Null
    $vcenters.GetEnumerator() | %{
      &{foreach($vc in $_.Value){
          $currentvc = Connect-VIServer -Server $vc      Get-Cluster -Server $currentvc | %{
            New-Object PSObject -Property @{
              "Cluster is managed by VC" = $currentvc.Name          Cluster = $_.Name          "# of ESX hosts" = @($_.ExtensionData.Host).Count          "# of VM" = Get-View $_.ExtensionData.Host -Server $currentvc |          %{@($_.Vm).Count} |          Measure-Object -Sum |          Select -ExpandProperty Sum        }
          }
        }} | Select "Cluster is managed by VC",Cluster,"# of ESX hosts","# of VM" |  Export-Xls -Path C:\report.xls -WorksheetName $_.Name  Disconnect-VIServer -Server $currentvc -Confirm:$false}
    

    You will have to render the Xls export function.

    Simplest is to include in the script with the code above.

    The name of the group is reflected in the name of the worksheet, having a separate line would be a little more difficult.

  • RICs when MergeTable using with the names of multiple tables

    Hello world!

    I just saw, as v11 OWM MergeTable media with the names of multiple tables. As I couldn't find anything in the documentation, here's a question:

    It also means, that RICs are automatically taken into account regarding the order of INSERTS/CHANGES/DELETES?

    That would actually really great and simplify the merge of our application mechanism a lot.

    Kind regards

    Andreas

    Hi Andreas,

    This feature works the same MergeWorkspace, but with a smaller set of tables.  Tables will always be merged into the order of the child table first, then the parent tables.  However, foreign key constraints are not validated until all tables have been merged.  This would prevent a mistake to be triggered when the child table merging before the parent merging table data in the parent workspace.

    Kind regards

    Ben

  • Problem report of multiple pages for ppt export

    Hi, I'm using version 11.1.2.1.0.83 workspace. When I export a report of multiple pages for powerpoint (from file/export/powerpoint) the ppt file created has just one page, which is the last page of the pdf report.

    Someone knows how to fix this bug, which is to export the powerpoint with the same numebr of pdf report pages?

    You can use Smart View of powerpoint and get the report here. You don't need external program.

    Concerning

    Celvin

    http://www.orahyplabs.com

  • Number of rows in multiple tables

    Hello

    Im trying to count the rows of multiple tables

    for example I need the select statement to produce the following

    County of table_name
    Table1: 5
    Table2 6
    3 3 table


    I came up with the following script, but it counts the number of tables that I

    Select object_name, (select count (*) from user_tables where table_name = object_name) to object
    where type_objet = 'TABLE '.

    Hello

    Use this query

    Select table_name, num_rows from user_tables

    He he's useful to you.

Maybe you are looking for

  • Laptop: unable to connect to Internet via WiFi

    I can't connect to the Internet when I'm on WiFi. What can I do? Bill

  • High temperature CPU on Tecra M5

    I don't know if it's normal, but my CPU has a normal temperature of 77 c, and when the CPU goes up to 50%, the temperature rises up to 100 ° C.Is this normal?My fan is always a lot of noise... I use Vista and of first instance for temperature - hardw

  • Media profiles created by papajohn on its website

    I downloaded photoshop 3 but also Director of windows on another computer window xp that I bought recently and I have try to add media profiles, created by papajohn on its Internet site. However, I am constantly messages "file is corrupted", how do I

  • I was wondering if ie9 will be available for windows xp users

    I was just wondering if microsoft came out with internet explorer 9 for people who have windows xp home .im running internet explorer 8 now.

  • Registry is corrupt and computer do not start

    I think my son has pulled my laptop on the couch on the floor, he also pushed a lot of buttons. The computer was frozen and when restarted, it could not start and went to repair module. It is said, "the registry is corrupted. What can I do about it?