How to create a triangle view with a select query?

I need help to build a select query that will create a triangle view.
Below is the table I have to query
*{color:#ff0000}INITIAL TABLE{color}*
*{color:#008000}AMOUNT | TRANSACTION_DATE | OPEN_DATE | TYPE{color}*
5 | 30-JAN-09 | 10-JAN-09 | A
10 | 12-JAN - 09 | 30-NOV-08 | A
20 | 30 - DEC - 08 | 15-OCT-08 | A
10 | 30 - DEC - 08 | 8 - OCT - 08 | A
*{color:#ff0000}THE FINAL TABLE I HAVE TO CREATE:{color}*
DEV_PERIOD - TO_CHAR(TRUNC(TRANSACTION_DATE,'Q'),'YYYY-Q') AS DEV_PERIOD
OPEN PERIOD - TO_CHAR(TRUNC(OPEN_DATE,'Q'),'YYYY-Q') AS OPEN_PERIOD
{color:#008000}*SUM of AMOUNT | DEV_PERIOD | OPEN_PERIOD | TYPE*{color}
5 | 2009 - 1 | 2009 - 1 | A
40 | 2009 - 1 | 2008 - 4 | A
30 | 2008 - 4 | 2008 - 4 | A
{color:#ff0000}*This is another view of the table (The triangle view)*{color}
| Dev_Period 2008- 1 | 2008 - 2| 2008 -3 | 2008 - 4 | 2009 -1 |
Open_Period |
2008 - 1..................... 0.......... 0............ 0........... 0.......... 0
2008 - 2 ..................................0............ 0........... 0.......... 0
2008 - 3................................................. 0........... 0.......... 0
2008 - 4 ..............................................................30......... 40
2009 - 1 .............................................................................5
Any ideas will be appreaciated.
Thank you!

I think the first thing you need to do is look up "pivot query" in this newsgroup. And how complicated your query gets to be will depend on your database version (11 natively supports pivot queries). You have a variable number of columns in your result set (depending on how many quarters you have in your data.
I think once you get the columns sorted out, working out the numbers to put in each column will be relatively easy.
Jon

Similar Messages

  • How to create a Type Object with Dynamic select query columns in a Function

    Hi Every One,
    I'm trying to figure out how to write a piplined function that executes a dynamic select query and construct a Type Object in order to assigned it to the pipe row.
    I have tried by
    SELECT a.DB_QUERY INTO actual_query FROM mytable a WHERE a.country_code = 'US';
    c :=DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(c,actual_query,DBMS_SQL.NATIVE);
    l_status := DBMS_SQL.EXECUTE(c);
    DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
    FOR j in 1..col_cnt LOOP
    DBMS_SQL.DEFINE_COLUMN(c,j,v_val,2000);
    END LOOP;
    FOR j in 1..col_cnt LOOP
    DBMS_SQL.COLUMN_VALUE(c,j,v_val);
    END LOOP;
    But got stuck, how to iterate the values and assign to a Type Object from the cursor. Can any one guide me how to do the process.
    Thanks,
    mallikj2

    Hi Justin,
    First of thanks for your reply, and coming to my requirement, I need to report the list of items which are there in the dynamic select statement what am getting from the DB. The select statement number of columns may vary in my example for different countries the select item columns count is different. For US its '15', for UK it may be 10 ...like so, and some of the column value might be a combination or calculation part of other table columns (The select query contains more than one table in the from clause).
    In order to execute the dynamic select statement and return the result i choose to write a function which will parse the cursor for dynamic query and then iterate the values and construct a Type Object and append it to the pipe row.
    Am relatively very new for these sort of things, welcome in case of any suggestions to make it simple (Instead of the function what i thought to work with) also a sample narrating the new procedure will be appreciated.
    Thanks in Advance,
    mallikj2.

  • [Solved]How to create ADF interface View

    Hi All,
    I have a design problem that I need some help with.
    In one of the pages in our application, we have two drop down boxes one with account type and another with account name (label) and account number (value).
    The account types are Escrow, Credit and Misc (some other types). all three types are in three different tables.
    Now the problem is, in the page when the account type is selected, the second drop down box should be filled with respective account numbers.
    So my question is Can I create an interface view and implement in all three different account type views and use it for second drop down box.
    Thanks in advance for your help.
    Thanks
    Praveen
    Message was edited by:
    bpraveen
    Message was edited by:
    bpraveen

    You might do a VO with a union of the three tables - use a custom SELECT like this:
    SELECT 'Escrow' account_type, account_number, balance, ... FROM escrow_accounts
    UNION
    SELECT 'Credit', account_number, balance, ... FROM credit_accounts
    UNION
    SELECT 'Misc.', account_number, balance, ... FROM misc_accountsUse NULL for any column in a table that does not have that column. I'm not sure if you can use Entity Objects (one EO per table) with such a VO to make the data updatable - it might have to be a read-only VO.
    Or create a database view with this SELECT and base the VO on that view instead of a table. You can even make the view updatable with INSTEAD OF triggers and base an EO on the view.

  • How to create a help view for a customized error message

    Hi all,
    Can you guide me how to create a help view for a customized error message, we need to put some suggestions in it so that user can can resolve this issue with this guide. ( the short text is too short to describe all situations via TC:SE91)
    Thanks very much!
    Bruce, Wen

    Hi Bruce,
    Could you brief your concerns again.
    Why don't you maintain long text in message class for long description.
    Regards,
    Ranjith N

  • How to create a material master with referrence to exsisting material maste

    hi experts
    how to create the material master with reference to an existing material master ?
    please explain in steps
    regards
    jai

    Dear,
    It is very simple.
    Enter  MM01 t-code.
    Enter your existing material code in field of reference material code.
    If your material number range is external number range then enter number of material otherwise direct enter industry sector and material type.
    After enter basic detail system ask you plant/storage location detail and view detail.
    Select reference plant and storage location in left sight of diglog and enter plant and storage location in right sight of diglog screen for which you want to maintain material master.
    Then click on all view, If you want to change some detail change it.
    Due to reference material all detail is come from reference material.
    Then click on save.
    NOTE: - You can create new material with reference of old material but it is prerequest material type should be same of both material old and new.
    Regards,
    Mahesh Wagh

  • How to create a materialized view on a subqueried view

    Hi,
    I have a view with subquery. This view is accessed by users frequently. I want to improve its performance by materialiezed view technology. Unfortunately, my view includes a subquery. does anyone have an idea how to create a materialiezed view on a subqueried view?
    Copper

    Oracle 9.2.0.4
    SQL,
    select
    action,
    id,
    id0,
    bl_ticker,
    report_type,
    published_date,
    version,
    decode(rating,'SBUY','Strong Buy',initcap(rating)) rating,
    nvl(fairvalue,(select fairvalue from ard_published_v2_log where id=(select max(id) from ard_published_v2_log where bl_ticker=a.bl_ticker and id<a.id and fairvalue is not null))) fairvalue,
    pricing_date,
    price,
    update_date,
    nid
    from
    select * from ard_published_v2_log
    union select * from nemo_published_history_corr where (action is null or action<>'D')
    minus select * from ard_published_v2_log where action='D'
    minus select * from ard_published_v2_log where id in (select id0 from ard_published_v2_log where id0 is not null)
    minus select * from ard_published_v2_log where id in (select id0 from nemo_published_history_corr where action='D')
    minus select * from ard_published_v2_log where id in (select id0_new from nemo_fillup_id0 where apply=1)
    minus select * from ard_published_v2_log where id>0 and rating='N/A' and price is null-- and nid is null
    ) a
    order by id desc

  • How to create production version & Explain with procedure

    how to create production version & Explain with procedure
    Madan

    Hi Madan,
    Production Versions are used to describe the production process to be used for planned / production order.
    Why is it required?
    Suppose you have 2/3 production lines and 2/3 alternative BOMs to produce one Finished Goods.
    How system will come to know which BOM and Routing to be used. This is done thru Prod.Version.
    In production version we maintain the combination of BOM and routing.
    Also it can be designed with lot size or validity period.
    Go to MM02--->MRP4 / Work scheduling view -
    > Prod.Version.
    Enter the validity period and lot size. and the production version should be unlocked.
    After entering the reqd. routing no. and BOM alternative , carry a check.
    After getting the Green signals ,Continue.
    Thus you have saved the prod. version.
    Mass processing TCode- C223.
    Hope it would clarify you the basic of production version.

  • How to create a navigation bar with custom made buttons?

    I'm used to work with a similar program as Muse. In there we can create a single button and link them together into a navigation bar. I have tried all sorts of tutorials but none of them is discussing this possibility.
    To summorize. The idea is to create a button in photoshop and to use this as a theme to build a navigation bar. Possible or not and how? Thanks for assistance. Rgds Rufin

    Hi Brad,
    Thanks for your reply.
    No, not really. I used to work with XARA up till now. And being an Adobe Cloud user I think it a bit silly using two different systems. In XARA I can create a custom button and turn them into a navbar. For your information I include a few links to sites I created with Xara and I would like to know if I can create the same type of navbars with Abobe Muse. I already found out that all the other functions are available and some work a lot better in Muse, but I’m stuck on the navbar issue. I know I can create a button in Adobe PS and use it in Muse. But I didn’t manage to figure out how to create a navbar in Muse on basis of a button created in PS.
    www.restaurant-cedric.be or www.discoamigo.com or www.radioparadijs.be
    Grtz,
    Rufin
    LOGO-RUFIN'S-REISBUREAU-outlook
    Koningslaan 36 – b31
    8300 Knokke – Heist
    Tel: 050621052
    Fax: 050621072
    e-mail:  <mailto:[email protected]> [email protected]
    <http://www.rufins.be/> http://www.rufins.be
    <http://www.travelcoop.be/> travelcoop_logo_2013[1]  <http://ferventreisagent.be/rufins-reisbureau> klein logo
    Van: Brad Lawryk
    Verzonden: zondag 12 oktober 2014 19:40
    Aan: RUFIN DUWEL
    Onderwerp:  How to create a navigation bar with custom made buttons?
    How to create a navigation bar with custom made buttons?
    created by Brad Lawryk <https://forums.adobe.com/people/Brad+Lawryk>  in Help with using Adobe Muse CC - View the full discussion <https://forums.adobe.com/message/6817739#6817739>

  • How to create a tree view in adobe configurator

    Hi
              How to create a tree view in adobe configurator
    Thanks 

    Please, can you explain what you mean exactly?

  • How to create a customized view in SCOM monitoring to view alerts

    Hi All,
    I am trying to create a customized view in SCOM 2012 R2 monitoring for command center team to have the alerts from Server OS, AD, Exchange and few other MPs. I understand that I can use the option "Create by Specific source" and by selecting the
    required sources but I don't want all the alerts from these sources to be listed there but only few alerts which the respective teams want it to be.
    Thanks in advance.
    Regards,
    Srini

    Hi All,
    I am trying to create a customized view in SCOM 2012 R2 monitoring for command center team to have the alerts from Server OS, AD, Exchange and few other MPs. I understand that I can use the option "Create by Specific source" and by selecting the
    required sources but I don't want all the alerts from these sources to be listed there but only few alerts which the respective teams want it to be.
    Thanks in advance.
    Regards,
    Srini
    Hi Srini,
    Based on the above requirement, You want to create a Dashboard view with Specific alerts but not all right ?
    Based on my understanding on your above requirement i created one in my SCOM. Please let me know if this is what you really wanted ?
    For the below you really need to know what are those alerts, ONLY those alerts you want to be displayed in the dashboard.
    Then Go to the Monitoring tab in SCOM and then Right click Active alerts and select New -> Select New Alert view
    When you select new alert view you will need to specify the Resolution state and the Specific alerts you want.
    In the below example i have selected "MSExchange Active sync Alert" as a example. So my goal is here such that only the alerts i have specified from my selection ( "MSExchange Active sync Alert") if it appears in New state will appear
    in this view not all other alerts.
    So for that i just used the below options:
    Resolution state & Alert name
    Resolution state = New
    Alert name = %MSExchange XXXXXXXX%
    Also as of i see there was no option for entering multiple alert names. But i think there is and i am still trying as it accepts some SQL Wild cards. So if any one has an idea what is the wild card what is to be used to mention multiple names in that Name
    view please let me know.
    Gautam.75801

  • How to create a special view for sharepoint list A and deploy this view to specific user personal view?

    How to create a public view for sharepoint list A and deploy this view to specific user personal view? Is that possible OOTB?

    Views cannot be exported or moved. Can you elaborate your requirement?
    --Cheers

  • How to create a relational view base on an xmltype table which included sev

    Hi,
    I am using oracle 11.2.0.1.0.
    how to create a relational view base on an xmltype table which content several different .xml files?
    Thanks.
    for examle:
    SQL> SELECT OBJECT_VALUE FROM document;
    Edited by: Cow on Jan 6, 2011 7:57 PM

    For example I already have these three xml files inserted into the document xmltype table.
    These xml files have same schemas. I have attached below.
    I want to show all elements/attribute values in xml files to relational view.
    Is this possible to create one big relational view to show everything
    or I have to create three separate relation views then use UNION to put together? Thanks a lot. Cow
    <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
    <document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 http://localhost:8080/home/DEV/xsd/spl.xsd">
    <id root="5ca4e3cb-7298-4948-8cc2-58e71ad32694"/>
    </component>
    </document>
    <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
    <document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 http://localhost:8080/home/DEV/xsd/spl.xsd">
    </component>
    </document>
    Edited by: Cow on Jan 4, 2011 9:51 AM

  • How to create an unsolved cube with awm???

    hi all,
    I readed the "Oracle Olap developer's guide to the Oalp api" and I found there's 2 type of Cube: Solved and Unsolved Cubes. And this document says: "... if all the data for a cube is specified by the DBA, then the cube is considered to be Solved. If some or all of the aggregate data must be calculated by Oracle OLap, then the cube is unsolved ..."
    I tried with awm 10.2.0.3.0A to create an unsolvedCube but I can't. All cubes I created are solvedCube. To know if a cube is solved or unsolved, I wrotte an program in Java to read informations of package mtm.
    Some one can tell me how to create an unsolved cube with AWM ou other soft please!

    SH is not a relational OLAP data model which is quite different from the GLOBAL schema which is based on an Analytic Workspace.
    If you change the aggregation method you will need to re-compute the whole cube which can be a very big job! You might be able to force the unsolved status be de-selecting all the levels on the Rules tab in AWM. However, I think by default analytic workspace OLAP models always provide a fully solved cube to the outside world. This is the nature of the multi-dimensional model.
    Relationally, as keys are located in separate columns a cube can be unsolved in that the key column only contains values for a single level from the corresponding dimension tables. If more than keys for different levels within the same dimension appear within the fact key column then the cube is deemed as being solved.
    Therefore, I am not sure you are going to get the information you require from the API. To changes the aggregation method you will have to switch off all pre-compute options and also disable the session cache to prevent previously calculated data being returned when you change the aggregation method.
    Hope this helps
    Keith Laker
    Oracle EMEA Consulting
    BI Blog: http://oraclebi.blogspot.com/
    DM Blog: http://oracledmt.blogspot.com/
    BI on Oracle: http://www.oracle.com/bi/
    BI on OTN: http://www.oracle.com/technology/products/bi/
    BI Samples: http://www.oracle.com/technology/products/bi/samples/

  • How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?

    1. How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?
    When multiple tables are involved , and the actual number of rows returned is more than what the explain plan tells. How can I find out what change is needed  in the stat plan  ?
    2. Does rowsource statistics gives some kind of  understanding of Extended stats ?

    You can get Row Source Statistics only *after* the SQL has been executed.  An Explain Plan midway cannot give you row source statistics.
    To get row source statistics either set STATISTICS_LEVEL='ALL'  in the session that executes theSQL OR use the Hint "gather_plan_statistics"  in the SQL being executed.
    Then use dbms_xplan.display_cursor
    Hemant K Chitale

  • How to create a Sales order with ref to Contract using Function Module

    How to create a Sales order with ref to Contract using Function Module BAPI_SALESDOCU_CREATEFROMDATA ?

    We have a unique situation where we like change the sold-to customer of the sales order
    once order has been created. These orders have been created using either by function module
    BAPI_SALESDOCUMENT_COPY or using BDC (VA01, Copy with reference).
    These two processes work abosolutely fine except someone might have change the sold-to
    customer of the ship-to customer of the original sales order. If this the case then the new
    sales order will be created with the old sold-to and with not the new sold-to.
    We tried using BAPI_SALESDOCUMENT_CHANGE and commit afterwards. We checked
    the returned parameteres of the BAPIs and they are all successful but sold-to remains the
    same old one.
    Any help would be much more appreciated.

Maybe you are looking for

  • Iphoto where are my pictures

    where are my pctures? i imported from iphone. i see no folder called iphoto library in (can't)finder, and i want to copy these photos onto a thumb drive.

  • Send live stream from local PC to global server

    hello, I'd like to capture audio/video from my local PC, and transmit it to a global server, which will send my content to some audiences. Since the local PC has no unique IP, the server can't call RTPManager.addTarget(...) to receive live stream. So

  • KM setup in portal

    Hi All, I want to implement KM setup in EP7 portal. Could anyone help me by providing some docs for the same. Many thanks in advance. Regards, Nithya K

  • Change font when replying a HTML messages

    I want to change the font when I reply an e-mail in HTML. The current font is big. A colleague of mine is able to reply using the same font the message was composed with his Android

  • Add elemts to a List Item with code.

    I am stuck, because I need to change the elements in a List Item over Oracle Forms 6i. I do not need to retrieve them from a database, I just need to add them programatically. Is there any function to do that? Edited by: john on 18-jul-2012 14:38 Edi