Overview and details of the records in the same mixing ratio

Hello, on the bottom I need to mix the results in the summary table and the records in the table of details in the same report.

To create the scenario:
CREATE TABLE ALPHA
(
ALPHA_ID     NUMBER,
ALPHA_NR     NUMBER,
ALPHA_TOTCT     NUMBER,
ALPHA_FUND     NUMBER

);

ALTER TABLE ALPHA ADD (
     CONSTRAINT ALPHA_PK PRIMARY KEY (ALPHA_ID));
ALTER TABLE ALPHA ADD (
     CONSTRAINT ALPHA_NR_UNI UNIQUE (ALPHA_NR));


INSERT INTO ALPHA(ALPHA_ID, ALPHA_NR)
VALUES( 1, 7 );
INSERT INTO ALPHA(ALPHA_ID, ALPHA_NR)
VALUES( 2, 11 );
INSERT INTO ALPHA(ALPHA_ID, ALPHA_NR)
VALUES( 3, 15 );
INSERT INTO ALPHA(ALPHA_ID, ALPHA_NR)
VALUES( 4, 17 );

CREATE TABLE HIST
(
HIST_ID     NUMBER,
HIST_NR NUMBER,
HIST_ALPHA_NR NUMBER,
HIST_CT          NUMBER,
HIST_VAL     NUMBER,
HIST_DATE     DATE

);

ALTER TABLE HIST ADD (
     CONSTRAINT HIST_PK PRIMARY KEY (HIST_ID));
ALTER TABLE HIST ADD (
     CONSTRAINT HIST_NR_UNI UNIQUE (HIST_NR));
ALTER TABLE HIST ADD (
     CONSTRAINT HIST_ALPHA_NR_FK FOREIGN KEY (HIST_ALPHA_NR) REFERENCES ALPHA ( ALPHA_NR ) );

TRUNCATE TABLE HIST;

INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 1 ,1    ,7 ,1 ,10 , TO_DATE('01.02.2009' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 2 ,6    ,7 ,1 ,10 , TO_DATE('01.05.2009' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 3 ,3    ,7 ,3 ,30 , TO_DATE('01.02.2010' , 'dd.mm.yyyy' ) );


INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 4 ,4    ,11 ,1 ,10 , TO_DATE('01.03.2009' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 5 ,5    ,11 ,-2 ,-20 , TO_DATE('01.06.2010' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 6 ,8    ,11 ,1 ,10 , TO_DATE('01.02.2011' , 'dd.mm.yyyy' ) );

INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 7 ,2    ,15 ,2 ,20 , TO_DATE('01.03.2009' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 8 ,7    ,15 ,5 ,50 , TO_DATE('01.06.2010' , 'dd.mm.yyyy' ) );
INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 9 ,9    ,15 ,-4 ,-40 , TO_DATE('01.02.2011' , 'dd.mm.yyyy' ) );

INSERT INTO HIST( HIST_ID ,HIST_NR ,HIST_ALPHA_NR ,HIST_CT ,HIST_VAL ,HIST_DATE )
VALUES ( 10 ,10    ,17 ,1 ,10 , TO_DATE('01.03.2011' , 'dd.mm.yyyy' ) );
To update the summary table, I used a view
CREATE OR REPLACE VIEW HIST_AGG ( HIST_ALPHA_NR,  TOT_CT  , TOT_VAL )
AS
SELECT HIST_ALPHA_NR
,SUM ( NVL(HIST_CT, 0 ) ) TOT_CT
,SUM( NVL(HIST_VAL, 0) )  TOT_VAL

FROM HIST
GROUP BY HIST_ALPHA_NR;


DECLARE

CURSOR cur
IS
SELECT
HIST_ALPHA_NR
,TOT_CT
,TOT_VAL
FROM HIST_AGG
;

BEGIN
FOR rec IN cur
LOOP

     UPDATE ALPHA
     SET ALPHA_TOTCT = rec.TOT_CT
     , ALPHA_FUND  = rec.TOT_VAL
     WHERE ALPHA_NR = rec.HIST_ALPHA_NR;

END LOOP;

END;
First report should the line overview Alpha tracked table of all the detail records of
HIST table and for each alpha_nr. At the end of report total overview
alpha of the table.
"SUMMARY";"ALPHA_NR";"ALPHA_TOTCT";"ALPHA_FUND";
;;;;
;7;5;50;
;7;1;10;01.02.2009
;7;1;10;01.05.2009
;7;3;30;
;11;0;0;
;11;1;10;01.03.2009
;11;-2;-20;01.06.2010
;11;1;10;01.02.2011
;15;3;30;
;15;2;20;01.03.2009
;15;5;50;01.06.2010
;15;-4;-40;01.02.2011
;17;1;10;
;17;1;10;01.03.2011
"TOTAL_ALPHA_NR";4;9;90;
Second report should display the overview by period (year), but the timeline
for example the year 2009 begins from the year 2010. At the end of each year a summary for
the current state.
"YEAR";"ALPHA_NR";"ALPHA_TOTCT";"ALPHA_FUND"
;;;
2009;7;0;0
;11;0;0
;15;0;0
;17;0;0
"Total 2009";4;0;0
2010;7;2;20
;11;1;10
;15;2;20
;17;0;0
"Total 2010";4;5;50
2011;7;5;50
;11;-1;-10
;15;7;70
;17;0;0
"Total 2011";4;11;110
2012;7;5;50
;11;0;0
;15;3;30
;17;1;10
"Total 2012";4;9;90

Hello

wucis wrote:
I now use this selection

...
FROM       hist        h
,       alpha        a
WHERE       h.hist_alpha_nr (+)     = a.alpha_nr
AND       a.active          = 'Y'
AND a.alpha_nr >=  NVL ( NULL  , 1 )
AND a.alpha_nr <=  NVL ( NULL  , 10000 )
AND a.alpha_date >= NVL ( TO_DATE( '02.01.2008'  , 'dd.mm.yyyy' ) , '01.01.2000' )
--AND h.hist_date  >= NVL ( TO_DATE( NULL  , 'dd.mm.yyyy' ) , '01.01.2000' )
--AND h.hist_date <= NVL ( TO_DATE( NULL  , 'dd.mm.yyyy' ) , '02.02.2222')
...

The problem is now, if I limit the query about the h.hist_date, the lines disappear when there is no entry in HIST for this ALPHA_NR,
in particular the line with alpha_nr = 12 disappears.

When you use the old notation join, outer join, whenever a column of a table is marked with the + sign, then all the conditions in the WHERE clause that references the same table need a sign +. Otherwise, the effect is identical to an inner join.
Using the old syntax, you must say something like:

...
FROM       hist        h
,       alpha        a
WHERE       h.hist_alpha_nr (+)     = a.alpha_nr
AND       a.active          = 'Y'
AND        a.alpha_nr          >=  1
AND        a.alpha_nr           <=  10000
AND        a.alpha_date           >=  TO_DATE ('01.01.2000', 'dd.mm.yyyy')
AND        h.hist_date (+)     >=  TO_DATE ('01.01.2000', 'dd.mm.yyyy')
AND       h.hist_date (+)     <=  TO_DATE ('02.02.2222', 'dd.mm.yyyy')
...

Notice the + sign in the last 2 lines, after the columns in this table of reference h. I find the ANSI join syntax much more clear in this case.

How you use NVL makes no sense. NVL (NULL, x) returns x, no matter what x is.
What you trying to do? Perhaps you meant

AND        NVL (a.alpha_nr, 1)          >=  1

Tags: Database

Similar Questions

  • Detailed form Master in Apex - creating main records and details at the same time

    I m trying to create a master form / retail.
    The master is a simple standard form and below on the same page there is a tabular presentation containing the details.

    I am facing a problem when you try to save a new record from the master at the same time with new details.
    If I create a new record of the master and at the same time create detail records for this master (on the same page), when I submit that the foreign key of the details field is not filled in. So only one master record gets inserted into the table and record line is not inserted.

    When I have everything first create a master without a detail and edit this master and then add details so everything's allright (since the primary key field is filled out at the time).

    I just need to confirm that whether in the APEX form master detail, can save master and line record at the same time or is it as master must be registered the 1 and then line must be enterd and saved?

    Please let me know, if this functionality can be achieved in the APEX.

    Hello

    There was an error in the process of pl/sql, you referenced f01 (F01. COUNT) in the loop condition and which should have been f03, also you have assigned the wrong field to what should have been P3_DEPARTMENT_ID

    I fixed that. Also, I'm not 100% sure but I think in order to use the table in the column must be of type text or something (and not hidden), but I can't check now because of lack of time.

    A few mistakes during the presentation, but they are still due to constraints on the other fields.

    FOR I IN 1.APEX_APPLICATION. G_F03. COUNTY

    LOOP

    APEX_APPLICATION. G_F03 (I): =: P3_DEPARTMENT_ID;

    END LOOP;

    Concerning

    Bottom

  • View photos and details at the same time.

    I have a large photo - license of foreign car collection-, but this query could also apply to anyone who has a collection of photos.

    I want to be able to choose to display each picture (organized by folders as usual) - with its relevant details (for example, where, when, who took the picture and a few lines of description, etc) AT the SAME TIME THAT the display of the photo itself.

    My system of 'My images' PC has the ability to hold these details - and discovers them - but not at the SAME TIME as the photo itself.

    I would also have my collection - with this installation - on a portable device (iPad, laptop, tablet or laptop?). My home PC is not portable.

    Someone with a collection of photos associated with a hobby - butterflies, train spotters, bird watchers, etc., etc. - should have already solved this requirement - and I would like to know how to do.

    Ian Drake

    Explorer is the 'file manager' which is an indispensable part of Windows since 1995. It's changed a bit over the years, with the W7 version even more oriented toward Visual representation than previous ones. Just press Windows key + E to open it.

    There are many ways to configure the display to get what you want. My screenshot is not far from that as you will see if you open the my pictures folder.

  • How to record the numbers and words in the same file

    Hello:

    I did a vi where I record the spectrum and its integration in different positions of a two-dimensional net. I save the information in two spreadsheet with the comand "write to file measure."

    Now, I am recording the parameters initial positions, end X X and space between measurement points. I want a file with two columns that looks like:

    Initial position X 1000

    final position X 2000

    space 100

    But idon't know how to save the words and numbers in the same file.

    As I have to perform several steps I want to automatically choose the name of the file (something like parameters_1, parameters_2...)

    Thank you for your attention

    Hi bitxor.

    You can use all the functions of the WriteTotext file to write strings to a file.

    Then you could set up WriteToMeasurementFile' to add new data to existing files (instead of overwrite or renaming)...

    BTW. It is not a good idea to mix lvm files containing arbitrary spreadsheet data!

  • Trying to record demo and training at the same time

    Ok... I remember when I got 8 Captivate you can record more than a software simulation both (multimode). I'm doing it, but I can't figure out how. I chose to add a software simulation and selected automatic as registration type. It seems I don't have the possibility to choose a type of simulation in the Mode menu: Demo, training, assessment, and Custom. What do I have to use Custom? When I select this option, I don't always anywhere to select more than one record mode. I want to record a demo and training at the same time. Thank you!

    This will not work because you are already in a single file, you can not expect suddenly to be converted into 3 files. It was exactly the same behavior for previous versions.

    To be able to capture in addition to a mode, you must start a new project with the file new software Simulation (or the old shortcut CTRL-R).

  • After saving a file PDF with a layer of Spot UV, all the highlights and details in the tones are flattened in the overprint preview. What I'm missing here?

    I'm trying to print business cards with a Spot UV coating. I have a layer above the work with a spot color (set to Green by request of the printer). Below is a logo, essentially a red circle with a few highlights and depth. My question is that, after exporting a PDF file, all of the highlights and details on the red circle disappear in the overprint preview (it is there when I hide Spot UV layer, but missing when I'm hiding the color of the task). What can I do to keep this information?

    Thank you!

    I managed to solve the problem and embarrass me in the process. It wasn't a problem with the settings, but rather a "stowaway" duplicate of a red circle that lurked on the layer UV Spot on top of all the details. Thanks for your help, but it seems that my problems require a different kind of forum!

  • Where can I get the complete list of features and details of the v28

    Where can I get the complete list of features and details of the v28, I searched a lot but could not find the official list of features.

    Try this:

    http://helpx.Adobe.com/Digital-Publishing-Suite/help/whats-new-release.html

  • Form and report on the same page...

    Hello

    I want to have a form and report on the same page... as soon as the user enters the information and send the form via the button then the report should be able to display adding...

    can I know how to do this...

    Thanks in advance

    Hello

    Its simple...

    01. firstly create a page with a region to allow the user to insert records.
    02. it's over then add another region and choose 'Report' and region type and generate a report to show the details of the table above

    Thank you

  • My iphone 6 does not light, I held the home button and power at the same time and no vibration or no sign of life, any suggestions as to what it could be would be appreciated

    Phone bought 3 days ago and I fight to turn it on, it's just a black screen, the phone records into iTunes but does not turn, I tried holding down the home button and power at the same time and still nothing, I presume that it's a battery problem as if it was the backlight then the phone vibrated when you press the power button help Please!

    Marley6921 wrote:

    Phone bought 3 days ago and I fight to turn it on, it's just a black screen, the phone records into iTunes but does not turn, I tried holding down the home button and power at the same time and still nothing, I presume that it's a battery problem as if it was the backlight then the phone vibrated when you press the power button help Please!

    Put it on wait ten minutes if the phone did not come one, then hold down the sleep/Home button until you see the apple logo and then release, make sure that the phone is still connected to the charger.

  • TCP Read and Write at the same time

    Hello everyone,

    I have a question about parallelism in TCP connections.

    I know that it is possible to read and write on the same connection ID.

    So, if you ReadTCP and WriteTCP block each other, if you use the same TCP connection ID?

    Or to request more precise if I run two while loops, in parallel, with one end by calling WriteTCP and the other called ReadTCP.

    one of the delay of loops (or block) will be the other if both loops call their VI TCP at the same time right?

    The system is Windows 7 and Labview 2012.

    Kind regards

    Sebastian

    They are perfectly parallel.  Just write in one and read it from the other.  There is no conflict.

    See My TCP articles for more details.

  • How to display two dept details at the same time in the form of master-detail

    Hi Experts

    In Forms 6I, using the Scott schema, table DEPT & EMP has created a simple form of master-details relationships.

    Currently when user Dept Block shows all lines dept and EMP block display data based on the selection of deptno.

    It's only a deptno both.

    If the user in the No. 10, block EMP Dept will display all the data related to 10

    If the user moves to 20 Deptno, block EMP will display all the data related to 20.

    And so on.

    But our requirement, what happens if we want to see the 10 and 20 at once (both several deptno)

    Thank you

    Thanks for your information.

    In fact, our requirement is only to display data, he own be no matter what update of data/insertion.

    So below and working for our requirement

    • Remove relationship
    • Additional box on master block.
    • Write code cursor on the box selection - which will fill/clear data block information based on the checkbox selection on block Master.

    Oracle Apps training: how to display two Department employee details at the same time in the master/detail relationship

  • R12: Copy a group of companies with configurations, metadata and data in the same instance of OA

    The idea was born to a very common condition between the companies IT. pre-sales and pro-ventes groups do various tasks, including the response of the RPF/RFI, PoC, building, Solution architecture, customer demo etc. Ususally they do not have the dedicated application instances, or rather they do not find a sufficient number of cases of applications dedicated to deep study of the road. Every other day a group cries out for an Apps instance and the same gets lift for senior management in short time. It gives a lot of pain to the infrastructure/DBA groups because they fail to meet people like them, due to the limited availability of free nodes, resources, networks and space etc.

    I have a Vision of the R12.1.3 (tell SID = VIS1213) installed on a Linux machine. The box is quite busy with his hearts limited, showing little free memory and the attached SAN has insufficient free space remaining. A group of Oracle Apps pre-sales consultants, says "Group 1", is the use of this.»

    Now the 3 other groups are asking for a R12.1.3 Vision instance separately for different reasons below. Each of them wants the instance again and do not share with others.

    Group 2 for deep study of the road against a critical response to RFP
    Group-3 for the development of a point of contact for a customer demo
    Group 4 for the manufacture of PUK media on some business processes

    In this scenario, I should install 3 distinct Vision of R12.1.3 (using CDs or downloaded zip) or clone VIS1213 in 3 different places with different SIDS, possibly on one or more separated nodes (as above Linux node has insufficient free resources). In this case, the need for available server resources and disk space multiplied by 3, so that DBA maintenance for these 3 new instances is added.

    Hope that I have clear air up to this point.

    Then I was thinking if we have "virtual instances" within an existing instance of Apps, by copying from a vertain org level. First I thought I'd take THE level, but it will not work if an instance of group to work with HRMS claims. We must therefore take business group level. After that we will create the appropriate role and responsibility, user profile options so that the new user can see and work on the new BG and data area down only. It will be like a separate instance to use.
    Benefits of my desired task will be

    -no separate server resource, the required network
    -no additional DBA not involved maintenance
    -no separate required backup plan

    So here it is to create 3 new "virtual instances" right within the same instance of VIS1213. New groups will have same URL, same existing TNS details but 3 credentials different existing access. Each of them would be limited in a way so that they can not see each and other data and can not hurt each and other changes.

    This can be achieved if we can copy an existing group of its activities with org structures, metadata and data, within the same instance. Oralce planning cannot be copied within the same instance configurations.

    What I've done so far was I manually created a new BG, attached an existing sobbing (CoA, Agenda / currency), created a new, copied and modified accounting structure flexfields before fixing, created the new ORGANIZATIONAL unit, and then a new InvOrg of master and a new InvOrg clild, defined the profile MO some GL and HR profiles. Then I extracted finished master and data assignment article category Masters against a master/child existing InvOrg, updated the data for newly created InvOrgs, inserted into tables insterface and ran seeded import conc program element. Except for a few, all data have been loaded into base against new InvOrgs tables.

    Then I tried with master provider (with sites and contacts). A few AP configurations are required, and then data provider (+ contact + site) have been loaded against OR newly created (under new BG) base tables.

    I do not proceed after that. I'm currently looking for ideas from the experts on how to go further.

    Planning is able to create this kind of 'virtual instance' within the same instance of OSTEOARTHRITIS?

    PL nowadays return.

    Thank you and best regards,
    Castelbajac Dhara
    E-mail: [email protected]

    PL don't post duplicate topics - R12: copy a group of companies with org, configurations, metadata & data structures

  • RMAN and repositories on the same database grid control

    What are the disadvantages of having the RMAN Repository and repository on the same database grid control?

    What effect does this have

    1. daily maintenance

    2. after disaster or high availability... or the recovery scenarios.

    3 is server performance with respect to the use of the CPU and memory - not desirable to have two repositories on the same database?

    Currently we have not a RMAN or a repository of GC. We intend to implement both. Angle of savings, it would be good if we can just build another data base for two repositories on an existing database server with 2 production databases. The server has enough CPU and RAM face for 1 new database, but that would mean an exaggeration to have 2 new databases.

    If it is not advisable to have two repositories on the same database, then we would need strictly two separate databases, in this case, we will need to go to a new database server host two databases, which the org seeks to avoid, as this would mean that to buy a new license.

    I tried searching a few books, but don't have no clear guidance on the same. Any opionion would really help. Thank you.

    Concerning

    S diallo

    Where this instance fails, all rman needs to restore is in the database control file. How to restore a database with rman from the command line, without a catalog. (The backup and Recovery Guide has details of how do.) This will get data back so that you can use the grid again control.

    In order to insure against a default of the machine hosting the instance, verify that the database is in log mode archive and protected with scheduled backups of hot and copy the backup files to another server.

    Other options for high availability, you have a license (Data Guard, RAC) could also be deployed for this instance, if you need more recovery options.

  • Master / detail on the same page

    Hello
    I tried to get master form Assistant / retail to generate a master / detail on the same page without success.

    Basically, I wanted something similar to what Patrick Wolf was here:
    http://Apex.Oracle.com/pls/OTN/f?p=12820:3:2557510002062602

    Y at - it statement somewhere that show how to set up a master / detail on the same page?

    Thank you

    Hello

    OK - you must:

    1 - create a report page - Let's say the report will build on the DEPT table and the SQL for the report is:

    SELECT DEPTNO, DNAME FROM DEPT ORDER BY DNAME
    

    2. when the page has been created, create a new un nouvel element element hidden page called, say, P50_DEPTNO and add it to the region of report

    3. now create another part of report on the page - this time for the EMP table and filtered by P50_DEPTNO. The SQL code of the report would be:

    SELECT EMPNO, ENAME FROM EMP WHERE DEPTNO = :P50_DEPTNO ORDER BY ENAME
    

    4. you can make this conditional region on P50_DEPTNO is not not NULL so that the latter is hidden until a Department has been selected

    5. now, change the State of your Department and go to the tab report attributes change DEPTNO column and go to the section of the link column. Add in the following settings:

    Text link: (select one of the predefined options that are displayed as links in this box - eg DEPTNO)
    Page: (enter the current page number - for example, 50)
    Reset pagination: (check this)
    Point 1 (name): P50_DEPTNO
    Article 1 (value): #DEPTNO #.

    Then click on apply changes

    6 - Finally, add a branch on the page. This should simply point to the same page - leave all other settings at their default values.

    Now, launch the page and click on the link for any Department. You should get: http://htmldb.oracle.com/pls/otn/f?p=45958:50

    Andy

  • on the Iphone 7. How to listen to music, if we have a normal headset and charge at the same time?

    How to listen to music, if we have a normal headset and charge at the same time?

    < re-titled by host >

    It sopposed must be a wireless charging dock to be launched shortly if the dock does not so it is a disappointment

Maybe you are looking for