How to rotate data when column headers are unknown?

Hi all

I have table below

create table asset_det)

ACC_NUM VARCHAR2 (32),

END_DATE DATE,

DATE OF INC_DT,

TYPE_INFO VARCHAR2 (10),

ASSET_CLASS_NAME VARCHAR2 (80).

NUMBER OF ASSET_VALUE

NUMBER OF SEQ,

NUMBER OF INTSEQ

);

that contains the details of the asset. Here are a few specimen of the table data.

ACC_NUMEND_DATEINC_DTTYPE_INFOASSET_CLASS_NAMEASSET_VALUESEQINTSEQ
2330 SEP-2013ASSETSTotal Canadian0.6491
2330 SEP-2013ASSETSTotal Canadian0.5992
2330 SEP-2013ASSETSTotal Canadian3.1293
2330 SEP-2013ASSETSTotal Canadian4.8194
2330 SEP-2013ASSETSTotal Canadian095
2330 SEP-2013ASSETSTotal Canadian096
2330 SEP-2013ASSETSCanadian fixed income0.64107
2330 SEP-2013ASSETSCanadian fixed income0.59108
2330 SEP-2013ASSETSCanadian fixed income3.12109
2330 SEP-2013ASSETSCanadian fixed income4.811010
2330 SEP-2013ASSETSCanadian fixed income01011
2330 SEP-2013ASSETSCanadian fixed income01012

I want output like,

ACC_NUM End_date Type_info ASSET_CLASS_NAME col1 col2 COL3 COL4 col5 col6
2330 SEP-2013ASSETSTotal Canadian0.640.593.124.8100
2330 SEP-2013ASSETSCanadian fixed income0.640.593.124.8100

Now, active number of rows of values can be modified to account for account and asset class-to-class of assets. I tried with pivot but not able to write correct query.

Can someone help me?

What version of Oracle you are on? When you say 14 columns, perhaps this may be a way to solve... (oracle version 11 g 2)

There may be some better versions of this solution, but this task any incorrect data modeling pointing I presume.

with dataset(ACCt_NUM ,END_DATE,   INFO_TYPE,  ASSET_CLASS_NAME , ASSET_VALUE,  SEQ,  INTSEQ) as
(
select   23, date '2014-09-30',  'ASSET', 'Total Canadian', 0.64, 9, 1  from dual  union all
select   23,date '2014-09-30',  'ASSET', 'Total Canadian', 0.59, 9 ,2   from dual  union all
select   23, date '2014-09-30',  'ASSET', 'Total Canadian', 3.12, 9 ,3   from dual  union all
select   23, date '2014-09-30',  'ASSET', 'Total Canadian', 4.81, 9,4   from dual  union all
select   23, date '2014-09-30',  'ASSET', 'Total Canadian', 0, 9 ,5   from dual  union all
select   23, date '2014-09-30',  'ASSET', 'Total Canadian', 0 ,9, 6   from dual  union all
select   23, date '2014-09-30',  'ASSET', 'Canadian Fixed Income', 0.64, 10, 7   from dual  union all
select   23, date '2014-09-30',  'ASSET', 'Canadian Fixed Income', 0.59, 10, 8   from dual  union all
select   23, date '2014-09-30',  'ASSET', 'Canadian Fixed Income', 3.12, 10, 9   from dual  union all
select   23, date '2014-09-30',  'ASSET', 'Canadian Fixed Income', 4.81, 10 ,10   from dual  union all
select   23, date '2014-09-30',  'ASSET', 'Canadian Fixed Income', 0 ,10 ,11   from dual  union all
select   23, date '2014-09-30',  'ASSET', 'Canadian Fixed Income', 0 ,10, 12   from dual )
  ,resultset as (SELECT acct_num,
         end_Date,
         info_type,
         asset_class_name,seq,
         LISTAGG (asset_Value, ',') WITHIN GROUP (ORDER BY intseq) str
    FROM dataset
GROUP BY acct_num,
         end_Date,
         info_type,
         asset_class_name,seq
)
select ACCT_NUM, END_DATE, INFO_TYPE, ASSET_CLASS_NAME, SEQ, regexp_substr(str,'[^,]+',1,1)  col1 ,
regexp_substr(str,'[^,]+',1,2)  col2,
regexp_substr(str,'[^,]+',1,3)  col3 ,
regexp_substr(str,'[^,]+',1,4)  col4 ,
regexp_substr(str,'[^,]+',1,5)  col5 ,
regexp_substr(str,'[^,]+',1,6)  col6 ,
regexp_substr(str,'[^,]+',1,7)  col7 ,
regexp_substr(str,'[^,]+',1,8)  col8 ,
regexp_substr(str,'[^,]+',1,9)  col9 ,
regexp_substr(str,'[^,]+',1,10)  col10 ,
regexp_substr(str,'[^,]+',1,11)  col11 ,
regexp_substr(str,'[^,]+',1,12)  col12 ,
regexp_substr(str,'[^,]+',1,13)  col13,
regexp_substr(str,'[^,]+',1,14)  col14
from resultset;

See you soon,.

Manik.

Tags: Database

Similar Questions

  • Load data form - column headers are not displayed

    Using Apex 4.1 on Oracle 11 g

    I built a spreadsheet download form, but when he goes to the mapping page does not load, without column headers.

    I checked shared components/logic/display/Load_hours.  It shows the correct schema/table.

    I checked the forum and found the following code as a solution in an archived message:

    < code >

    () apex_040100.wwv_flow_api.create_load_table

    P_ID = > 56199422249645921 + wwv_flow_api.g_id_offset,

    p_flow_id = > wwv_flow.g_flow_id,

    p_name = > "LOAD_HOURS"

    p_owner = > 'MDM_DATA ',.

    nom_table_p = > 'REF_STORE_HOURS_UPLD ',.

    p_unique_column_1 = > 'EVENT_NAME ',.

    p_is_uk1_case_sensitive = > 'n',.

    p_unique_column_2 = > 'LAST_MOD_DT ',.

    p_is_uk2_case_sensitive = > 'n',.

    p_unique_column_3 = > ",

    p_is_uk3_case_sensitive = > 'n',.

    p_wizard_page_ids = > ",

    p_comments = > ");

    < code >

    It gave me an error so I added this before the line:

    < code >

    wwv_flow.g_flow_id: = nvl(wwv_flow_application_install.get_application_id,400);

    wwv_flow_api.g_id_offset: = nvl(wwv_flow_application_install.get_offset,0);

    < code >

    Now, I get the following error:

    < error >

    ORA-20001: Package variable g_security_group_id must be set.

    ORA-06512: at "APEX_040100.WWV_FLOW_API", line 71

    ORA-06512: at "APEX_040100.WWV_FLOW_API", line 17166

    ORA-06512: at line 6

    < / error >

    Where can I find the g_security_group_id? any other tips?

    Thank you

    Tim

    Bug in 4.1.  4.2 installation of fix

  • How to make the vertical column headers?

    Dear Apex Experts,

    I have an interactive relationship with many columns. All column headers are long.

    I hope to do the vertical column headings. Is this possible?

    My favorite browsers are Firefox and Chrome

    Best regards

    The CSS redesign of + {: identifier of the thread = 2263484} + for an interactive report:

    table.apexir_WORKSHEET_DATA th {
      /* Column headers need to have sufficient height to contain the longest header oriented vertically */
      height: 10em;
      /* Line up column headers at the bottom of the header row */
      vertical-align: bottom;
    }
    table.apexir_WORKSHEET_DATA th div {
      /* Left-aligned text will appear bottom-aligned under 90 deg left rotation */
      text-align: left !important;
      /* Get rid of underlined link in vertical orientation (and fix really weird bug on iOS) */
      text-decoration: none !important;
    
      /* Set the origin for the transforms: "bottom left" corner of header text; this works better than the default (center) */
      -webkit-transform-origin: bottom left;
      -moz-transform-origin: bottom left;
      -o-transform-origin: bottom left;
      -ms-transform-origin: bottom left;
    
      /* Transform column headers: 90 deg left rotation + 12px down brings the new "left" (top) edge to the original text left position */
      -webkit-transform: rotate(-90deg) translateY(12px);
      -moz-transform: rotate(-90deg) translateY(12px);
      -o-transform: rotate(-90deg) translateY(12px);
      -ms-transform: rotate(-90deg) translateY(12px);
    }
    table.apexir_WORKSHEET_DATA th div img {
      /* Position sort direction icon in correct orientation at end of header */
      margin-left: 4px;
      -webkit-transform: rotate(90deg);
      -moz-transform: rotate(90deg);
      -o-transform: rotate(90deg);
      -ms-transform: rotate(90deg);
    }
    

    (For some approximations of this term) in collaboration with a custom on APEX 4.1.1.00.23 in Firefox 5.0 theme (customer current is clueless but locked). No possibility to try on something else for hours.

    I am 100% certain that it won't work without modification under different themes, font sizes, fonts, lengths section, the width of the columns, IR modes and any other variable that you care to think...

  • How will I know when the capsules are on?

    Original title: caps Inspiron 1545?

    How will I know when the capsules are on?

    Hey, Vince,.

    Caps lock key are you referring?

    If you look above the keyboard on the right, you will see two fires instead of one.

    In addition, you will type in uppercase when the key is turned on

  • How can I change the columns that are displayed and their order of left/right in the view of local files?

    He said title. Currently, files display column headings are ' Local Files/size/Type/update the/CheckedOutBy ' how I don't mind view the Type, or maybe the positions of swap of Type and size?

    Site > Manage Sites > Edit > avancΘs > file view columns

  • How oracle inserts data in columns

    Hi guys, just a quick question. When we have a primary key on 4 columns, and we have, say 20 million lines, and we want to add an additional line. How oracle checks if the data on the primary key is unique for recording added compared to the 20 million lines. They actually compare recording added to all rows in the table?

    Published by: 969224 on May 10, 2013 08:14

    969224 wrote:
    Hi guys, just a quick question. When we have a primary key on 4 columns, and we have, say 20 million lines, and we want to add an additional line. How oracle checks if the data on the primary key is unique for recording added compared to the 20 million lines. They actually compare recording added to all rows in the table?

    Published by: 969224 on May 10, 2013 08:14

    Not the entire line, it compares the 4 columns in the INDEX against the 4 columns in the new row.

  • How to reset data when switching between two subforms

    I have two subforms that are either displayed or hidden based on a radio button selection.

    If '1' option button is selected, subform1 is visible and subform2 is hidden and vice versa.

    It's hard for me to explain, please bear with me.

    I want to do is to clear the fields in the subform if you switch backwards between subforms.

    For example:

    1. click on the button '1' (visible subform1)
    2 fill subform1.

    3. click on button '2' (subform1 now hidden)

    4. click on the '1' button (subform1 is visible and the fields are white( )

    I found the script in another post for a similar problem below. I put it as an event "click" for each item in the Radio button, but I don't know where it is supposed to go like the other post said no. It works, but it gives off the entire form, not only the fields in the subform.

    xfa.host.resetData ("xfa.form.form1.subform1");

    Can someone tell me the good script to make my form to work?

    Please keep it simple. The extent of my knowledge of JavaScript is basically cut and past and hope it works. If this does not work, it is by the grace of God only. I couldn't tell you the difference between a SOM and a node.

    So, if anyone has an answer, please mute with regard to the level of a third-grade student.

    According to your hierarchy the command to reset the al as the Subform1 fields would be:

    xfa.host.resetData ("form1. Page1.Subform1");

    If you want to reset the data from more than one object you can separate them with commas, as follows:

    xfa.host.resetData ("form1. Page1.Subform1', 'form1. Page1.Subform2");

    Note that the commands are case-sensitive. .you used a tiny s to the subform so the expression in quotes does not begin with xfa.

    The order will go between the braces in the section where test you the radioButton control to the value you want.

    If you want to reset when the user selects Yes then put it in the if section. If you want when they choose No., put it in the other section.

    Paul

  • How to backup data, when the desktop is wired and mobile wireless ethernet?

    ISP is at & t Uverse packaged for TV, phone and Internet.

    The laptop shows the home network when the desktop is turned off.

    The office only displays the router when the laptop is turned off.

    It defeats the purpose of a backup when the office is off,

    because that's when you need the backup at first.

    Any way around this dilemma?

    My answer to 1. Data personal such as My Documents, photos and favorite.

    2 try to back up data on the other computer?  This question gives me a clue, that's why a computer displays the network folder while the other computer if off, but not vice versa.

    I think the best solution, as I said elsewhere, is back up to an external hard drive.

    3. I don't have an online connection.

    I have now two methods that work.  So, thank you very much for your help, Stephanie Podder.

  • IR column headers are not displayed in a collapsible area on oracle apex

    Hi all

    I packed a report interactive and region definition > model is defined as a foldable in Apex5.0.

    When I run this page it does not display the column headings in the report. Is there a property to set when we use the folding model?

    Thank you

    Ketan

    Hi Ketan

    Go to the report of the attributes-> position-> change this property to 'None '.

    -Sunil Bhatia

  • ADF how complete the data when the page is loaded

    I want to fill with data on a table page loading time 2 or more by pressing the key.

    Hello

    "Expensive another problem that I have a parameter for example P_teacher_id and which connection teachers with his ID he can see his own presence and review... mean how to pass single parameter on multiple pages."

    Equip your variable longer scope (Session or Page Flow) range use throughout the application...

    Thank you.

  • How to display data when the page loads

    I use JDeveloper/Oracle ADF 11.1.2.3.0.

    I have a jsf with a table page that was built by a named query. I chose the research with the table option when you drag the query named on the page.

    The named query uses a connection variable which is not set with the loading of the page. Therefore, no data is display even if the query is executed.

    But, I can then click on the button Search and display of the data.

    I tried to set the default value of the variable binding '%' in the OV, but that did not work.

    So, is it possible that I can get all the data displayed when the page is loaded. Perhaps by the calling program the by clicking the search button?

    Thanks for your help.

    Open the criteria to view that you defined in the t for your group, "indication of interface user" tab and check the box 'automatically interrogate. "

    Timo

  • How to rotate the duplex column?

    Hi all

    I want yo use duplex swivel column. However, the following code works fine however, I do not know how to do two-sided swivel column, should I add a name to additional column clause?
    with 
    pivot_tab as (select month, stat_id, error_id  from qc_t q join surveys s on q.survey_id = s.survey_id
    where qa = 1 and q.error_id in (1, 2, 3, 5, 8, 9, 20)) 
    select * from pivot_tab 
    pivot (
    count(*) for (error_id) in (1, 2, 3, 5, 8, 9, 20)) 
    order by 1, 2;
    
    ----------------------------------------------------------------------------
    
    Output:
    
                    col1 col2 col3 col4 col5 col6       col1 col2 col3 col4 col5 col6       col1 col2 col3 col4 col5 col6    
    stat_id 
    100          2   3  4  2  8  1    1                  1   1   1  1  1  1  1                         2   4  5 2 5 2     3 
    101           2   2  3  1  4  1  4                     2   2  4 1   4   1                         3    5   6   2   1   1   
    102          ............
    .
    .
    .
    I use the following syntax, but it does not work
    >
    pivot_tab as (select month, stat_id, qc_t error_id q join surveys s on q.survey_id = s.survey_id)
    where qa = 1 and q.error_id (1, 2, 3, 5, 8, 9, 20))
    Select * from pivot_tab
    pivot)
    Count (*) (month, error_id) (1, 2, 3, 5, 8, 9, 20))
    order by 1, 2;
    >



    I want just the following
    Sample:
    
    
                            first_col1                              first_col2                         first_col3
                    col1 col2 col3 col4 col5 col6       col1 col2 col3 col4 col5 col6       col1 col2 col3 col4 col5 col6    
    stat_id 
    100          2   3  4  2  8  1    1                  1   1   1  1  1  1  1                         2   4  5 2 5 2     3 
    101           2   2  3  1  4  1  4                     2   2  4 1   4   1                         3    5   6   2   1   1   
    102          ............
    .
    .
    .

    You must use tuples:

    SQL> select  *
      2    from  (
      3           select  job,
      4                   deptno,
      5                   sal
      6             from  emp
      7          ) pivot (sum(sal) for job in ('CLERK','SALESMAN','MANAGER'))
      8  /
    
        DEPTNO    'CLERK' 'SALESMAN'  'MANAGER'
    ---------- ---------- ---------- ----------
            30        950       5600       2850
            20       1900                  2975
            10       1300                  2450
    
    SQL> select  *
      2    from  (
      3           select  job,
      4                   deptno,
      5                   sal
      6             from  emp
      7          ) pivot (sum(sal) for (job,deptno) in (('CLERK',20),('SALESMAN',30),('MANAGER',10)))
      8  /
    
    'CLERK'_20 'SALESMAN'_30 'MANAGER'_10
    ---------- ------------- ------------
          1900          5600         2450
    
    SQL> 
    

    SY.

  • SQL Developer 4.0 column headers

    I give!  Uncle, uncle, uncle!

    I've migrated Developer SQL 3. xxx to 4.0.  My questions appear more column headers.  I looked in 'preferences' and have not found the answer.  I tried the SQL commands that work in SQL * more.

    What Miss me?  How can I get my column headers in the output?

    Result of 'show all' include pagesize-1 and linesize-1.

    Ah, sorry!   I forgot that the rule is a bit more complicated in my first post.  PageSize 0 and road remove column headers.  In addition (from a few notes of discussion)...

    In SQLDeveloper, we decided to have the LINESIZE and PAGESIZE-1 value default if the table is printed without any restrictions on the dimensions (LINESIZE & PAGESIZE).  Yes does not print the columns of labels for = - 1 PAGESIZE and LINESIZE > 0 and any indented for data.

    In SQLPlus, we cannot set PageSize-1, but when we set the PAGESIZE = 0 and LINESIZE > 0 will not print labels, but the results of line indentation will be same in

    SQLDeveloper.

    So, for your case, make sure as leave on and pagesize and linesize either at their default value of-1, or both the value greater than 0.  If you want to automatically set to the default values, then in...

    Tools > Preferences > Database (don't forget to expand the database, and then click on it, so it has the focus) > name of the connection startup script file

    provide a specification file for a script that contains these SET statements.  A concept similar to SQL * more check the existence of a login.sql script.

    Best wishes

    Gary

  • No Visible column headers

    Hi all

    I'm under APEX 5.0.0.00.31.  I created a page that contains a radio button group with 7 columns, 7 interactive reports (migrated from classic reports) and 7 dynamic actions.

    When loading the page, the only thing visible is the Group of radio buttons, because reports are hidden by the DAs.  When you select a year in the radio unit, the corresponding international registration is displayed.  Select another year, a new report shows, and the previous report is hidden.  This part works fine, except for one thing.  The column headers are not visible.  If I go to the Actions Menu, select lines per page and select any number of rows, the column headers are displayed.  If I click on a radio button, the new report appears, but without the column headers.  Selecting a value of lines per Page causes the column headings appear.  I tried to run the application in Firefox and IE edge with the same results.

    Any thoughts?

    Bob

    wisers wrote:

    I'm under APEX 5.0.0.00.31.  I created a page that contains a radio button group with 7 columns, 7 interactive reports (migrated from classic reports) and 7 dynamic actions.

    When loading the page, the only thing visible is the Group of radio buttons, because reports are hidden by the DAs.  When you select a year in the radio unit, the corresponding international registration is displayed.  Select another year, a new report shows, and the previous report is hidden.  This part works fine, except for one thing.  The column headers are not visible.  If I go to the Actions Menu, select lines per page and select any number of rows, the column headers are displayed.  If I click on a radio button, the new report appears, but without the column headers.  Selecting a value of lines per Page causes the column headings appear.  I tried to run the application in Firefox and IE edge with the same results.

    Any thoughts?

    Looks like it could be related to error in foldable interactive report 5.0 of Apex.

    The elephant in the room is the reason why you use 7 interactive reports to view information for different years. Why not use one and set up the SQL report?

  • Model of how APEX handles data (values)?

    Reference {: identifier of the thread = 2486655}

    I am trying to get a model of how APEX handles data (values). There are several places (?) data (values) that may exist. Or so it seems. I'm trying to understand how these work - to put all the pieces together.

    Question:
    (A) where data can be?
    (1) in the database
    (2) for the session
    (3) rendering - and then displayed on the screen, if a value displayed - but not in the session
    (4) in perhaps (?) a few (?) memory work pool but different from the rendered page of values, I see on the screen?
    (5) other?

    Why I think that it's relevant?
    Question:
    (B) attended the session different from that made, then when the code runs, the values and values that (rendering or session) if he runs against?

    And maybe the answer is, "You don't understand what is happening." Yes, "exactly!" Where the question.

    Best wishes
    Howard

    Hello

    If you like to have 'default value' in session state, use the calculation.
    And as you've noticed, you need to before calculation of the item is made to get the same "default" session state and the screen.

    Kind regards
    Jari
    -----
    My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai

Maybe you are looking for

  • Pavilion x 2: failure ID 9lxlrf-71585v-mfpv61 - 619 d 03

    What does this report mean? Failure ID 9lxlrf-71585v-mfpv61 - 619 m 03 As I can see the hard drives of this material in the menu setup?

  • HP pavilion zv5000: missing zv5000 system drivers of base after installing windows 7

    After installing windows 7 displays device management point exclaimation Hardware ID: PCI\VEN_104C & DEV_8201 & SUBSYS_006B103C & REV_01PCI\VEN_104C & DEV_8201 & SUBSYS_006B103CPCI\VEN_104C & DEV_8201 & CC_088000PCI\VEN_104C & DEV_8201 & CC_0880 Also

  • Call

    I can't make a call. When I compose, I'm immediately notified "call ended" even without having to hear the phone to the other line to ring. Initially, I thought before the network was having a bad signal or the problem is on the other line. Hoping to

  • (GET MORE) On a printer C309n Hp Photosmart Premium Web application does not connect to the internet?

    Hello everyone; Does anyone know why the app GET MORE on this printer Hp Photosmart Premium Web C309n does not connect to the internet? All other applications are connected ok. The site is down? someone knows something about it? HP is the fixation of

  • Cannot restart dbcontrol

    Hi, I have a problem with dbconsole. 11.2.0.3, running on AIXI have 2 DB on the same server. I am able to start dbconsole on each DB (emctl start dbconsole) and connect both without problem.However when I close them, then I'm impossible to restart it