Hwo to create a matrix report in sql Plus

i want to create matrix report in SQL plus for emp table. how is it possible
requirement is as following
Deptno -- Clerk -- Salesman--Manager
10----------2500---3500--------4500
20----------2400---3400--------4400
30----------1400---4400--------5400

Hi,
Do a search on this site on
-'pivot'
and/or:
-'stragg'
and/or:
-'columns to rows'
to get many example that will give you ideas.
Also you forgot to mention this:
What's the value of the job titles?
Sum of salary of....?
edit
Using my data:
MHO%xe> select deptno, job, sal from emp order by deptno
  2  /
    DEPTNO JOB              SAL
        10 MANAGER         2450
        10 PRESIDENT       5000
        10 CLERK           1300
        20 ANALYST         3000
        20 CLERK            800
        20 CLERK           1100
        20 ANALYST         3000
        20 MANAGER         2975
        30 MANAGER         2850
        30 SALESMAN        1600
        30 CLERK            950
        30 SALESMAN        1250
        30 SALESMAN        1500
        30 SALESMAN        1250
14 rijen zijn geselecteerd.I would get:
MHO%xe> select deptno
  2  ,      sum(decode(job,'CLERK',sal,0)) CLERK
  3  ,      sum(decode(job,'SALESMAN',sal,0)) SALESMAN
  4  ,      sum(decode(job,'MANAGER',sal,0)) MANAGER
  5  from   emp
  6  group by deptno
  7  order by deptno
  8  /
    DEPTNO      CLERK   SALESMAN    MANAGER
        10       1300          0       2450
        20       1900          0       2975
        30        950       5600       2850Edited by: hoek on Oct 17, 2009 3:19 PM

Similar Messages

  • How to create a matrix report on Apex 4.1

    Hi all.
    I need to create a report similar to this one:
    Jan Feb Mar .....
    Product Category
    Category One 999 999 999
    Category Two 999 999 999
    On a reporting tool like Oracle Reports, this is call a matrix report which can be easily created: just one simple query , select a matrix report type, compute summary values for row /column and grand total, and that is.
    How would one implement this on Apex 4.1???
    Have a couple of ideas:
    - Populate temporary table with columns corresponding to month.
    - Create a procedure that return a collection and use that as a source for report.
    - Etc.
    What other options do i have ...?
    Thanks in advance ...!

    Hi all,
    I did create a matrix report using the pivot function and some interesting settings in APEX. So far it is only does display data. I did not find a way yet(?) to alter the data in the same matrix.
    The data is based on a simple set of tables about planning. The end result does look something like the matrix below. Note: the dashes are just there to make the matrix look like a matrix on this forum.
    Resource 13-08 20-08 27-08 03-09 10-09 17-09 24-09
    Angelo-----25-----22-----12-----10------------------------
    John---------8-----22-----36-----22------------------------
    Marit-----------------5-----40-----36-----24-----12-----10
    The resources (Angelo, John and Marit) are being registered in the following table:
    CREATE TABLE EVP_RESOURCES
    RSS_ID NUMBER(10,0) NOT NULL,
    NAME VARCHAR2(25 BYTE) NOT NULL
    The date periods (13-08 till 24-09) are being registered in the next table:
    CREATE TABLE EVP_DATA_POINTS
    DPT_ID NUMBER(10,0) NOT NULL,
    DATA_POINT_DATE DATE NOT NULL,
    V_DATA_POINT_DATE_FORMATED VARCHAR2(75 BYTE) GENERATED ALWAYS AS (TO_CHAR("DATA_POINT_DATE",'dd-mm')) VIRTUAL VISIBLE
    The virtual column (v_data_point_date_formated) is not needed. You can use this virtual column or format the column in multiple places.
    The available units are being registered in the intersection table below:
    CREATE TABLE EVP_RESOURCE_PLANNING
    RPG_ID NUMBER(10,0) NOT NULL,
    DPT_ID NUMBER(10,0) NOT NULL,
    RSS_ID NUMBER(10,0) NOT NULL,
    UNITS NUMBER(10,0)
    The data is being displayed in APEX in a report region of type "SQL Query (PL/SQL function body returning SQL query)". And the following option has to be switched on "Use Generic Column Names (parse query at runtime only)".
    This does give a restriction on the number of columns which can be used. You can however change the number of columns in the field "Maximum number of generic report columns:" to a high number. So in most cases this is no issue at all.
    In the Region Source I did put the following code:
    begin
    return 'select *
    from ( select rss.name "Resource"
    , v_data_point_date_formated
    , rpg.units
    from evp_resources rss
    , evp_data_points dpt
    , evp_resource_planning rpg
    where rpg.dpt_id = dpt.dpt_id
    and rpg.rss_id = rss.rss_id
    pivot (sum(units) for v_data_point_date_formated in (' ||
    evp_pkg_dpm.f_dynamic_pivot_in ||
    order by 1';
    end;
    The function evp_pkg_dpm.f_dynamic_pivot_in does return a string which is based on the number of rows in the table evp_data_points. In my case this string is: '13-08' as "13-08",'20-08' as "20-08",'27-08' as "27-08",'03-09' as "03-09",'10-09' as "10-09",'17-09' as "17-09",'24-09' as "24-09". If you ommit the 'as "..."' you do get quotes in your headings.
    Enjoy and regards,
    Jurgen
    PS: let me know if something is missing or not clear!
    Edited by: user553427 on Aug 17, 2012 5:46 AM (Query has been made more simple and I build up the header differently)

  • How to create a matrix report

    Hi all,
    i want to create a matrix report manually by writing the query how can i create it in reports builder 10g
    please give me the details steps or any documentations for this so can i easily create the matrix report and also design
    for the matrix report. Please give me specific examples for creating the matrix report.
    plz give me the detail steps.
    please reply.......

    Have a look at this http://download.oracle.com/docs/cd/E12839_01/bi.1111/b32122/orbr_matrix.htm#g1017642
    -Ammad

  • Please help create this matrix report

    Hi,
    I'm using Reports6i.
    I want to create a matrix report like below.
    Country            JUN2008       JUL2008
                      Teu    Feu     Teu   Feu
    INDIA             13        9       1     10  .....
    .With the query i've written, i get the data like
    Country      Dt       Cnt       Typ
    IN     JUN2008           9             Feu
    IN     JUN2008           13     Teu
    IN     JUN2008           10             Feu
    IN     JUN2008           1     TeuPlease Help
    Edited by: Divya on Jun 21, 2011 5:55 AM

    Which tool are you using to create the report Divya?
    You may use PIVOT to create the matrix like report.
    For Ex;
    SELECT *
    FROM (SELECT product_code, quantity
    FROM pivot_test)
    PIVOT (SUM(quantity) AS sum_quantity FOR (product_code) IN ('A' AS a, 'B' AS b, 'C' AS c));
    A_SUM_QUANTITY B_SUM_QUANTITY C_SUM_QUANTITY
    210 90 160

  • Print a report from sql*plus.

    Regards all
    Let me know whether it is possible to print a hard report rom sql*plus and how.
    waiting

    Let me know whether it is possible to print a hard report rom sql*plus Yes. SPOOL is a command to get SQL*Plus screen results to disk real-time.
    and how.A "report" is such a generic term, that you will have to get started with at least some reading :)
    http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/server.920/a90842/toc.htm
    (search for: "How Can I Learn SQL*Plus")
    You may also address specific questions about the SQL*Plus product (that are not really Database SQL and/or PL/SQL related) via the [Technologies>Tools>iSQL*Plus] forum rather than here.
    waiting That's up to you! Dig in!
    Michael O'Neill
    Publisher of the PigiWiki
    clever-idea.com

  • How to do the matrix report in dis.plus?

    hi
    How to develop the matrix report in Dis.Plus.
    Regadrs
    Manikandan

    Consider this thread dead. Thread with all answers is found with the same title just about at the same time.

  • Matrix report from SQL

    Hi,
    I need generate a matrix report where row and column data will be dynamic. So, is there any way to generate this kind of report using SQL.
    Column name will itself a data.
    Eg.
    Column Name (on top) will be the projects name lying with the filter condition
    Row name (on left side) will be the user name.
    Value (of the matrix report) will be the Hours entered by the user for that project.
    Thanx.. Ratan

    Hi Frankfurt,
    Thank. I agreed with you, using any UI tool it is
    easy to do. But this is the case where this work has
    to be done only by back-end.
    I tried to use PIVOT but I think this is not a
    command of Oracle9i.
    So any other idea?PIVOT is only available from 11g
    You still haven't clarified if you really mean you want a dynamic number of columns or there is a fixed number of columns. If the answer is dynamic then you can only do this, to the best of my knowledge, using the technique in the link I gave. If fixed then we can work out some simpler pivot code for you (although a search for 'pivot' on this forum will show many many examples already).
    ;)

  • Can we use xml Publisher reporting for sql* Plus in EBS

    Hello All,
    The current report is designed in Sql* Plus Executable report and the output is in txt format, Now the requirement is to have the output in Excel format.
    So is it possible to use the xml reporting and make the output as Excel from the word template we design from MSword as we do for rdf(I have done few reports created in rdf to xml publisher reports in EBS and stand alone as well.).
    Do the same procedure will suit for Sql*Plus reports tooo or Is there any work around to achieve this.
    Thanks and Regards
    Balaji.

    Hi
    Thanks for the reply..
    I tried to do the follwoing
    1. changed the output to xml in the conc. prog.
    2. ran the same report but i am getting the follwoing error in the output file
    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource
    Other reports which are using the Oracle Reports(rdf) as source, i am able to generated the xml as expected....
    So my question is whether we can use sql* reports executable and generate xml in the conc.prog.
    if any one has used the sql*reports for xml publisher reporting... please let me know, so that if its possible i will check my sql needs some validation or tuning...
    thanks in advance
    Balaji.

  • How to create a matrix report with xml

    Hi,
    I have a problem with a maxtrix report ,I got the output from the application but I don't know how to create it at the bi puplisher in order to get the righte template.
    So if any one know the answer or have a useful decomentation send it me .
    Eman.

    Have a look at this http://download.oracle.com/docs/cd/E12839_01/bi.1111/b32122/orbr_matrix.htm#g1017642
    -Ammad

  • RMAN reporting using SQL*PLUS

    I am trying to create a report that will take some of the rman schema views/tables and put it in a specified format for a report. I need to get the database name, start day and time, end day and time, how long the backup took in seonds, the backup status and the number of bytes of the backup. I also need it to span 2 days, i.e 6pm yeterday to 8am today. So far here is what I have:
    select a.name,
    to_char(MIN(b.start_time), 'MM-DD-YYYY') as "Start_Day",
    to_char(MIN(b.start_time), 'HH24:MI:SS') as "Start_Time",
    to_char(MAX(b.completion_time), 'MM-DD-YYYY HH24:MI:SS') as "End Day",
    SUM(b.elapsed_seconds) as "Seconds",
    b.status
    from rman.rc_database a, rman.rc_backup_set b
    WHERE a.DB_KEY = B.DB_KEY
    AND a.DBID = B.DB_ID
    AND trunc(b.Start_time) = trunc(sysdate)
    GROUP BY a.name, b.status
    order by 2,3,1
    It only works for the current day and I can't seem to find the byte size for the backup piece. Any suggestions on how this should work I would relly appreciate it.

    This is not a right forum to post your problem. This is SQL PL/SQL forum.
    Please post it in Database General Forum.
    Regards.
    Satyaki De.

  • Creating database using command in SQL*plus

    Hi,
    Its not an urgent question.
    I'm learning Oracle DBA. I have installed Oracle 9.2 in my windows system. And I am trying to create a database using SQL command.
    OracleVersion : 9.2
    Operating System Windows XP
    CREATE DATABASE suri
    USER SYS identified by manager
    USER system identified by surendra
    LOGFILE GROUP 1 ('F:\Oracle\oradata\suri\redo01.log') SIZE 100M,
            GROUP 2 ('F:\Oracle\oradata\suri\redo02.log') SIZE 100M,
            GROUP 3 ('F:\Oracle\oradata\suri\redo03.log') SIZE 100M
       MAXLOGFILES 5
       MAXLOGMEMBERS 5
       MAXLOGHISTORY 1
       MAXDATAFILES 100
       MAXINSTANCES 1
       CHARACTER SET US7ASCII
       NATIONAL CHARACTER SET AL16UTF16
    DATAFILE 'F:\Oracle\oradata\suri\system01.dbf' size 200M EXTENT MANAGEMENT LOCAL
    UNDO tablespace undots datafile 'F:\Oracle\oradata\suri\undots01.dbf' size 200M
    DEFAULT TEMPORARY TABLESPACE tempts1 DATAFILE 'F:\Oracle\oradata\suri\temp01.dbf' SIZE 100M EXTENT MANAGEMENT LOCAL
    I'm getting error like below while executing the CREATE DATABASE command.
    ERROR at line 16:
    ORA-25139: invalid option for CREATE TEMPORARY TABLESPACEI have validated the syntax but not able to find where the error is.
    Please let me know if you need any further details.
    Thanks in advance for your help.
    Regards,
    Suri

    Welcome.
    why I got error when I use DATAFILE in CREATE DATABASE command (In oracle documentation also it shows as DATAFILE only)See http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_55a.htm#2127439
    Also, error description may be helpful...

  • How to create a matrix like report with description column

    Hi,
    currently i have two tables - one describing a job and another describing the stock. it is a simple relation where a job uses stock.
    i join job and stock using stock_code. there are three categories of stock - namely envelope, insert, stationary.
    i wish to create a cross tab report - basically i would like it to look like
    jobname, envelope, stationary, insert
    abc, e1, s1, i1
    , ,s2,i2
    def, e2,s3,i4
    , e3, , i5
    basically for each job i would like to place the stock code under envelope, stationary, or insert based on what type of stock it is. i can do this in sql, however, i get left with blank spaces.
    i do this by
    select     
    "FILE_PARAMETER"."FILE_NAME" as "FILE_NAME",
    "CATEGORY",
    "STOCK"."STOCK_CODE" as "STOCK_CODE",
    decode(upper("CATEGORY"), 'LASER', "STOCK_CODE", '') "LASER",
    decode(upper("CATEGORY"), 'ENVELOPE', "STOCK_CODE", '') "ENVELOPE",
    decode(upper("CATEGORY"), 'INSERT', "STOCK_CODE", '') "INSERT",
    decode(upper("CATEGORY"), 'INSERT',"STOCK"."DESCRIPTION",'') "DESCRIPTION"
    from
    "FILE_PARAMETER" "FILE_PARAMETER",
    "JOB_OVERVIEW" "JOB_OVERVIEW",
    "STOCK" "STOCK"
    where
    "FILE_PARAMETER"."FILE_NAME"="JOB_OVERVIEW"."AP_JOB_CODE"
    and "FILE_PARAMETER"."SCODE"="STOCK"."STOCK_CODE"
    ORDER BY "FILE_PARAMETER"."FILE_NAME", "CATEGORY"
    unfortunately this doesn't give me exactly the output i want. i would like it to show the first piece of stock in each category on the first line, and each subsequent stock on the line after that for each job group. my solution at the moment will put the stock in the corresponding stock category column but i have been unable to find a solution to removing the blank space.
    i have created the matrix report in developer and it can do what i want, however, it will not show the description for insert only. the way i have grouped it, it wants to show it all, and being a reports newbie i have no idea how to fix that
    any solutions would be very much appreciated!

    This feature is supported in MS Access and known as CROSSTAB through TRANSFORM function.
    In Oracle this exists but not in a elegant way as in MS.
    You have addition function GROUP BY ROLLUP and CUBE and GROUP BY GROUPING SETS, available in 10g, which can help you.
    Look in manuals and play with it!

  • How to create a crystal Report using C# and SQL Server

    Hi, im new in creating crystal report using SQL Server, and im making a project.. and could someone help me how to connect your .sdf (SQL Server File) from the bin to your crystal report? thanks a lot.. i followed some instructions like this one (https://social.msdn.microsoft.com/Forums/vstudio/en-US/48c0dd48-5b23-49da-8601-878f8406125e/how-to-create-a-crystal-report-using-sql-server-visual-c?referrer=http://social.msdn.microsoft.com/Forums/vstudio/en-US/48c0dd48-5b23-49da-8601-878f8406125e/how-to-create-a-crystal-report-using-sql-server-visual-c?referrer=http://social.msdn.microsoft.com/Forums/vstudio/en-US/48c0dd48-5b23-49da-8601-878f8406125e/how-to-create-a-crystal-report-using-sql-server-visual-c?referrer=http://social.msdn.microsoft.com/Forums/vstudio/en-US/48c0dd48-5b23-49da-8601-878f8406125e/how-to-create-a-crystal-report-using-sql-server-visual-c?forum=csharpgeneral)
    but i got an error on the adding of server name and database portion.. thanks a lot in advance

    Hello,
    Crystal Reports are supported on
    http://scn.sap.com/community/crystal-reports.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • How to create Matrix report in 9iAS portal

    Could u pls explain with an example how to create an Matrix Report using Web Portal wizard bcos I need to create many complex reports with user parameters where I am not getting flexibility in WebDb to create such reports.
    Thank you

    Hi,
    to make a matrix you will have to know the column values of your matrix. If this is known then you can use decode in your select statement to format the columns of your matrix. An example for selecting the salaries per department and per ename would be as follows:
    select ename,
    decode(deptno, 10, sal) d10,
    decode(deptno, 20, sal) d20 ,
    decode(deptno, 30, sal) d30 ,
    decode(deptno, 40, sal) d40
    from emp
    group by ename, deptno,sal
    Hope this helps,
    kind regards,
    Frank van der Borden
    Oracle support services

  • Hello, Any body tried to create Matrix Report in Portal?

    Any leads?
    Thank you.
    Madhav

    You cannot create a matrix report in Portal as of now.
    But still you can create it using Oracle Reports
    and call that report as one of the portlet using External applications/Oracle Reports access method.

Maybe you are looking for

  • Live Cam Voice on HP DV8305 -- Video image very slow

    I installed Live! Cam Voice on my HP DV8305 succussfully, it works, but the video image is very slow. it needs about 30sec to capture a frame, sometime just stucked. I changed the Display Adaptive Driver, used differrent USB IF, checked my CPU and Me

  • How do I use iMessage between an iPhone & an iPod Touch?

    How do I use iMessage between an iPhone & an iPod Touch?

  • Removing columns heading for a perticular page in ALV list display

    Dear All, For last page of my ALV list display i need to remove columns heading (Strictly for single page only). Kindly help me with possible solution. I am triggering page break by  using group attribute in the sort catalogue.(  l_v_sortcat-group   

  • Reason rewire question

    I have an instrument from Reason rewired into Logic and it works fine. But when I select a new track in Logic (eg piano), my instrument from Reason plays in addition to the piano. I've had this happen in the past but can't remember what to do! Is it

  • Publishing static web reports

    Hi experts!!! I need to publish static web reports...with my understanding...I guess I have to do like this...Can anyone guide  in correct way if its wrong... First design query in Query designer...then go to WAD and design your template with appropr