Bj or view to flatten "cell" records into "row" record

I have ProdPrice records which are essentially "cells" in a price matrix.
create table ProdPrice {
ProdNum number (12,0),
Quality char(1),
Condition char(1),
Price number(15,3),
... (other stuff)
with primary key (ProdNum, Quality, Condition)
where Quality is in [ 0, 1, 2, 3 ] and Condition in [ 0, 1, 2 ]
I want to create a view or object view representing one "row"
in the matrix with that "row" containing all prices with the same Quality. Essentially I want to "flatten" the cells into Quality "rows"
for viewing and editing.
An example Quality "row" type might look like:
create type ProdPriceQualityRow {
ProdNum number (12,0),
Quality char(1),
PriceCondition0 number(15,3),
PriceCondition1 number(15,3),
PriceCondition2 number(15,3),
PriceCondition3 number(15,3)
I think I now need to
create view ProdPriceQualityRowView of type ProdPriceQualityRow
with object identifier (ProdNum, Quality) as ....
but I'm not sure how to complete the view / object and its associated instead of trigger.
Does anyone have any examples of how to create views / objects / triggers that work like this?
I've read most of the Oracle Application Developers Guide - Object Relational Features but can not seem to warp their examples into the above.
Thanks
R.Parr
Temporal Arts

For examples goto askTom.Oracle.com and search for "pivot table".

Similar Messages

  • Obj or view to flatten "cell" records into "row" record

    I have ProdPrice records which are essentially "cells" in a price matrix.
    create table ProdPrice {
    ProdNum number (12,0),
    Quality char(1),
    Condition char(1),
    Price number(15,3),
    ... (other stuff)
    with primary key (ProdNum, Quality, Condition)
    where Quality is in [ 0, 1, 2, 3 ] and Condition in [ 0, 1, 2 ]
    I want to create a view or object view representing one "row"
    in the matrix with that "row" containing all prices with the same Quality. Essentially I want to "flatten" the cells into Quality "rows"
    for viewing and editing.
    An example Quality "row" type might look like:
    create type ProdPriceQualityRow {
    ProdNum number (12,0),
    Quality char(1),
    PriceCondition0 number(15,3),
    PriceCondition1 number(15,3),
    PriceCondition2 number(15,3),
    PriceCondition3 number(15,3)
    I think I now need to
    create view ProdPriceQualityRowView of type ProdPriceQualityRow
    with object identifier (ProdNum, Quality) as ....
    but I'm not sure how to complete the view / object and its associated instead of trigger.
    Does anyone have any examples of how to create views / objects / triggers that work like this?
    I've read most of the Oracle Application Developers Guide - Object Relational Features but can not seem to warp their examples into the above.
    Thanks
    R.Parr
    Temporal Arts

    For examples goto askTom.Oracle.com and search for "pivot table".

  • Function Module to convert multiple records into single record and vice-ver

    hi,
    i have a requirement to convert 10 records in an internal table to single record which should be passed
    to a single variable and store in the database.Kindly let me know is there any function module
    which meets my requirement. Also i need to do split one single record to 10 records each of
    say 65 length interval.
    kindly provide me if there is nay functinon module as such.
    I can do with ABAP-OOPS.Please suggest function module.

    I dont think such FM exists, but if you wanna code one it would be simple. Just loop through the internal table, keep concatenating the currently processing record into a long character variable to convert 10 records into one record.

  • Split one record into multiple records in Update Rules

    Hello All,
    I am trying to split a single record from R/3 into 2 records.
    My data flow is form R/3 > PSA > ODS > Cube
    when loading data into ODS i have to add the original record as it is to ODS. For second record i have to check a condition, & change few keyfigure values to 0 and fill an extra field.
    Example:
    Record in R/3 :
    Month | %1 | %2 | %3 | % 4 | ORGUNIT | JOB| EMPLOYEE| POSITION|
    02.2006 | 0 | 1 | 0 | 0 | 3000000| 248 | 2546352 | 500000 |
    Record in BW Comm_Structure.
    In Transfer rules i m writing an extra field to the R/3 record.
    Month | %1 | %2 | %3 | % 4 | ORGUNIT | JOB| EMPLOYEE| POSITION| NEW_FIELD |
    02.2006 | 0 | 1 | 0 | 0 | 3000000| 248 | 2546352 | 500000 | 2546352 |
    NEW_FIELD transfer routine :
    If employee NE 0
    Result  =  employee
    else.
    Result = 0 .
    Till this point everything works fine.
    Now i want to load this record into an ODS. I want to split the above single record into 2 records.
    Records in ODS should be :
    Month | %1 | %2 | %3 | % 4 | ORGUNIT | JOB| EMPLOYEE| POSITION| NEW_FIELD |
    02.2006 | 0 | 1 | 0 | 0 | 3000000| 248 | 2546352 | 500000 |  0 |
    02.2006 | 0 | 0 | 0 | 0 | 3000000| 248 | 2546352 | 500000 |  2546352 |
    Condition for NEW_FIELD.
    For first record always NEW_FIELD =0.
    For Second Record
    If NEW_FIELD NE 0.
    Cahnge KF's  %1, %2, %3, %4 = 0.
    If EMPLOYEE is 0 then no need to create extra record.
    I tried to use achieve this using return table, but no success.
    Can any one help me with ABAP syntax please. I am bit weak in ABAP Programming.
    Thanks in advance.
    POPS

    Dear:
    You could do so in update routines. Select the 'return table' option.
    useful links:
    https://forums.sdn.sap.com/click.jspa?searchID=10118555&messageID=2906656
    https://forums.sdn.sap.com/click.jspa?searchID=10118555&messageID=913873
    https://forums.sdn.sap.com/click.jspa?searchID=10118555&messageID=2441579
    Thanks

  • Split a record into multiple records

    Hi,
    I have situation where i need to split a record into multiple records.
    InputData :
    value|BeginDate |EndDate
    15 |2002/10/15|2002/10/16
    13 |2002/10/13|2002/10/20
    19 |2002/10/19|2002/10/23
    10 |2002/10/10|2002/10/12
    OutPut :
    10 |2002/10/10|2002/10/12
    13 |2002/10/13|2002/10/15
    15 |2002/10/15|2002/10/16
    13 |2002/10/16|2002/10/19
    19 |2002/10/19|2002/10/23
    Thanks

    Hi ,
    As a far I understood from your example ,
    I have few questions...
    1. You have information about the patient in a 1 source table.
    2. how u are identifying for patient X u need 5 rows to be created. R u storing these informations in seprate table or how ...
    3. if you have these information in a seperate tables ..... a simple cross join in ODI should get you the expected result.....
    Or give some more information with a example ..that would be great ...
    Thanks

  • How To Split One Record  into 30 Records(Number of days in a Month)

    Hi Experts,
      we are getting the montly(yearmonth) Forecast data from flat file we need to generate the report which shows the daily Forecast data,
    For example for the month of June Forecast we have  150EA.
    Flat file data is like this
      0calday    Qty
      201006     150
    we need to show the report like datawise
       Calday                                     Forecast qty
    20100601                                          5
    20100602                                          5
    20100603                                          5
    20100604                                          5
    20100605                                          5
    20100606                                          5
    20100630                                           5
    its like month forecast / Number of days in a month.
    we can achive these  in two ways as per my knowledge
    1. At the time loading data
    2. Reporting level
    Which is the best way
    how can we achive this.
    Thanks
    Chandra

    Hey.  There was a similar posting I gave a suggestion on a while back.  Here is the link...
    Re: Spliting records into cube
    As far as the correct time of doing this, I would definitely do this at the time of data load and not time of reporting. 
    Hope you find it helpful.
    Thanks

  • Splitting the single record into multiple records based on validity

    Hi Guru's,
    basically i am an BI consultant with less knowledge on ABAP, can i request your help on the ABAP task.
    I am working on HR module which is integrated with SAP BI,  the reports will be executed based on calendar month the requirement is i should split the single record into a multiple records based on validity of the record.  basically the HR data would be in data from and date to. 
    below is the logic
    Check whether the start and end date of the record are in the same month and year.
    If yes  nothing changes
    If no  create multiple records
    1st record  original start date of the record u2018till end of that month
    Following record  1st of the next month  u2018till last day of the month
    u2026
    Last record  1st of the month u2018till original end date.
    All fields will have the same values, only the datefrom and dateto fields change.
    Can any one please provide me the same code to proceed on my task.
    Thanks and Regards,
    Venkat

    Hi,
    Using Rule group we can split it.
    Using Rule Group in SAP-BI  Part - 1
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/s-u/using%20rule%20group%20in%20sap-bi%20%20part%20-%201.pdf
    Thanks
    Reddy

  • Split a record into multiple records (rows)

    I am using ODI to move data from source system to target system .Both are Oracle . In the source system I have a record which I need to split into multiple records or rows in the target system based on some rules . How can I achieve this in ODI . Please explain

    Hi ,
    As a far I understood from your example ,
    I have few questions...
    1. You have information about the patient in a 1 source table.
    2. how u are identifying for patient X u need 5 rows to be created. R u storing these informations in seprate table or how ...
    3. if you have these information in a seperate tables ..... a simple cross join in ODI should get you the expected result.....
    Or give some more information with a example ..that would be great ...
    Thanks

  • Spilting a record into multiple record

    Hi experts, need your help for your to frame a query for the below requirement
    Scenario 1
    For a same store fetch the record with least priority (35) and check if the Servicearea begin date & Servicearea end date of that store is minimum for that group.
    If minimum then select that record alone as shown below
    Item DC Store Serviceare Bgn Date Service Area End date Priority
    9856698 1469 2952 3/5/2011 12/31/9999 100
    9856698 3107 2952 12/10/2011 8/3/2012 35
    Item DC Store St Date End date Priority
    9856698 3107 2952 12/10/2011 8/3/2012 35
    Scenario 2
    For a same store fetch the record with least priority (35) and check if the Servicearea begin date & Servicearea end date of that store is minimum for that group.
    If not minimum split the records for that group as shown below and select the record which has the lowest priority(35) and with minimum startdate and end date range.
    Item DC Store Serviceare Bgn Date Service Area End date Priority
    9856698 1469 2952 3/5/2011 12/31/9999 35
    9856698 3107 2952 12/10/2011 8/3/2012 100
    Item DC Store St Date End date Priority
    9856698 1469 2952 3/5/2011 12/9/2011 35
    9856698 3107 2952 12/10/2011 8/3/2012 100
    9856698 1469 2952 8/4/2012 12/31/9999 35

    Here comes the scenarios.....
    Scenario 1                              
    Query should check for priority record(25), if the start_date and end_date of that priority record is the max i that group, records will not have any split.
    output will be the same.
    DC     Store     St Date     End date     Priority          
    955     3     1/1/2010     12/31/9999     25          
    966     3     4/5/2011     10/10/2011     50          
    977     3     10/12/2011 12/12/2012     100          
    output                         Priority     
    955     3     1/1/2010     12/31/9999     25     1     
    966     3     4/5/2011     10/10/2011     50     2     
    977     3     10/12/2011 12/12/2012     100     3     
    Scenario 2
    If priority record is not covering the max range, then split the records as shown below,
    1. during the time period 1/1/2011 & 4/30/2011 there were no other DC for that store so rank would be 1
    2. the next range would be 5/1/2011 to 6/29/2011 we have 2 records in service so the record with low priortiy would be ranked 1 and second priority would be ranked 2
    3. similarly, for 6/30/2011 to 10/1/2011 we have 3 records in service and it will be ranked accordingly on the priority.
    DC     Store     St Date     End date     Priority          
    966     3     6/30/2011     10/1/2011     25          
    955     3     5/1/2011     11/30/2011     50          
    977     3     1/1/2011     12/31/2011     100          
    output                         Priority     
    977     3     1/1/2011     4/30/2011     100     1     
    955     3     5/1/2011     6/29/2011     50     1     
    977     3     5/1/2011     6/29/2011     100     2     
    966     3     6/30/2011     10/1/2011     25     1     
    955     3     6/30/2011     10/1/2011     50     2     
    977     3     6/30/2011     10/1/2011     100     3     
    955     3     10/2/2011     11/30/2011     50     1     
    977     3     10/2/2011     11/30/2011     100     2     
    977     3     12/1/2011     12/31/2011     100     1     
    Scenario 3     
    This works similar to scenario 2
    DC     Store     St Date     End date     Priority          
    966     3     2/1/2011     12/31/2011     25
    955     3     1/1/2011     12/31/2012     50          
    977     3     5/1/2011     06/31/2011     100          
    output                         Priority     
    955     3     1/1/2011     1/31/2011     50     1     
    966     3     2/1/2011     12/31/2011     25     1     
    955     3     2/1/2011     12/31/2011     50     2     
    977     3     5/1/2011     6/30/2011     100     3     
    955     3     1/1/2012     12/31/2012     50     1

  • Split and reformat single record into multiple records

    Hi ,
    I need to split 1 record in to  2 records with 1 new field(event)
    I have one internal table in this format
    No country stdate          enddate
    1    us        12/01/2006  10/07/2007
    i need to reformat this record like ;
    NO country  event    pldate           acdate 
    1     us          ga      12/01/2006   12/01/2006
    1     us          es      10/07/2007   10/07/2007
    Can any one resolve this issue?

    Check the example.
    report zrich_0001 .
    data: begin of itab occurs 0,
          no type i,
          country(3) type c,
          stdate  type sy-datum,
          enddate type sy-datum,
          end of itab.
    data: begin of itab2 occurs 0,
          no type i,
          country(3) type c,
          event(2) type c,
          stdate  type sy-datum,
          enddate type sy-datum,
          end of itab2.
    itab-no = 1.
    itab-country = 'US'.
    itab-stdate = '20061201'.
    itab-enddate = '20071007'.
    append itab.
    loop at itab.
      clear itab2.
      move-corresponding itab to itab2.
      itab2-event = 'GA'.
      itab2-enddate = itab-stdate.
      append itab2.
      clear itab2.
      move-corresponding itab to itab2.
      itab2-event = 'ES'.
      itab2-stdate = itab-enddate.
      append itab2.
    endloop.
    loop at itab2.
      write:/ itab2-no, itab2-country, itab2-event,
              itab2-stdate, itab2-enddate.
    endloop.
    Regards,
    Rich Heilman

  • Converting column header and a single record into rows

    Lets suppose the table with only one record
    col1 col2 col3-----Column Header
    d1 d2 d3
    i want it in following manner
    column_name Column_data----Column Header
    col1 d1
    col2 d2
    col3 d3
    for this i have written the query as
    select column_name,column_data from (select * from XXX where col1=123)
    MODEL RETURN UPDATED ROWS
    dimension by(col1)
    measures (col1,0 column_name,0 column_data )
    ignore nav
    rules ITERATE(167)
    column_name[iteration_number]=cast( iteration_number as varchar2(3)),
    column_data[iteration_number]=cast( iteration_number as int)
    here i am just assigning iteration_number but i want to assign name of the column and its value;
    Note:--table contains nearly 200 columns

    Something like (using one of my own tables):
    select column_name colname,
           decode(column_name,'RUN_NO',to_char(run_no),
                              'SEARCH_ID',to_char(search_id),
                              'PROCESSING_START_DATE',to_char(processing_start_date,'DDMMYYYYHH24MISS'),
                              'PROCESSING_END_DATE',to_char(processing_end_date,'DDMMYYYYHH24MISS'),
                              'NO_OF_MATCHES',to_char(no_of_matches),
                              'ERROR_DETAILS',error_details,
                              'ADVREP_TIMESTAMP',to_char(advrep_timestamp,'DDMMYYYYHH24MISS')
                  ) colvalue
    from partial_search_history, (select rownum r, column_name
                                  from user_tab_columns
                                  where table_name = 'PARTIAL_SEARCH_HISTORY')
    where run_no = 356You can build the decode by doing
    SELECT ''''||COLUMN_NAME||''',TO_CHAR('||COLUMN_NAME||'),'
    FROM user_tab_columns
    where table_name = 'PARTIAL_SEARCH_HISTORY'A decode on DATA_TYPE field would allow you to add a format mask for DATE fields if necessary.

  • More than one records merge into one record

    Hi,
    I would like to merge multi records into one record.
    For example
    program_id campus_code
    12345 ABC
    56789 ABC
    56789 EFG
    56789 XYZ
    98765 XYZ
    the output is as follows:
    program_id campus_code
    12345 ABC
    56789 ABC EFG XYZ
    98765 XYZ
    How can I get this result? Thanks in advance.

    Go to asktom.oracle.com and search for stragg
    Regards,
    Steve Rooney

  • Added records and transferred records

    What is the difference between "transferred records" and "added records" in Infocube-> manage->requests ??
    Karthik

    Hi Karthik,
    You may have 2 records in the source data with same characteristic values. Then these two will be sumarized and added as a single record.
    say suppose:
    C01   M01   100   200
    C01   M02   200   400
    Now only one record is added to Infocube
    C01   M01   300   600
    -> When there are multiple records with in a same request with same characteristic combinations, They will be summarized while updated to Cube.
    In the above case: No. transferred records = 2
    No. Records Added = 1  
    In this kind of scenarios... Always No. transferred records will be more or equal to Added records.
    Some scenarios like where You split records into multiple records using Time distribution or return table... Example: You have monthly revenues in a flat file. But you want to split them into weekly records(based on averege model) and load to Cube. In this kind of scenarios the Added records will be more that Transferred records.
    So-> Dont expect the added records = Transferred records always.
    Hope this helps.
    Suman
    Message was edited by: suman kumar
    Message was edited by: suman kumar

  • Split records into Multiple csv files using a Threshold percentage

    Hi Gurus,
    I have a requirement to split the data into two csv file from a table using a threshold value(in Percentage) .
    Assume that If my source select query of interface fetches 2000 records , I will provide a threshold value like 20%.
    I need to generate a csv1 with 400 records(20% of 2000) and the rest of the records into another csv2.
    For implementing this I am trying to use the following process.
    1) Create a procedure with the select query to get the count of records.
    Total Records count: select count(1) from source_table <Joins> <Lookups> <Conditions>;
    2) Calculate the Record count to first CSV using the threshold_value.
    CSV1_Count=Total records count /threshold_value
    3) Create a view that fetches the CSV1_Count(400) records for CSV1 as follows.
    Create view CSV1_view as select Col1,Col2,Col3 from source_table <Joins> <Lookups> <Conditions>
    Where rownum<=CSV1_Count;
    4) Generate CSV1 file using View 'CSV1_View'
    5) Generate CSV2 File using the Interface with same select statement (with columns ) to generate a CSV.
    select Col1,Col2,Col3 from source_table ST <Joins> <Lookups> <Conditions>
    Left outer join (Select Col1 from CSV1_View ) CS on CS.Col1=ST.Col1 where CS.Col1 is null;
    Which gives the Total records minus the CS1_View records.
    The above process seems a bit complex and very simple . If any changes in my Interface I also need to change the procedure (counts the no:of records).
    Please provide your comments and feedback about this and looking for your inputs for any new simple approach or fine tune the above approach.
    Thanks,
    Arjun

    Arjun,
    This are my thoughts and Lets do it in 3 Steps
    Step 1.  ODI Procedure
    Drop table Temp_20 ;
    Create table Temp_20 as select * from table where rownum < ( SELECT TRUNC( COUNT(1) /5) FROM TABLE ) .
    [ ** This way iam fetching approx 20% of the table data and loading into Temp table . 1/5 th is 20%  so i am dividing count by 5
    I don't believe View will help you especially with RowNum as if you run the same query with rownum < N the rows order might differ . so Temp table is great ]
    Step 2 .  Use OdiSqlUnload  with select columns  from temp_20
    Step 3 . Use again OdiSqlUnload  with  select columns from table where  ( uk keys ) not in ( selecy uk_keys from temp_20)
    [** this way you can pick the remaining 80% ** and the data will be not repeat itself across 20% and 80% , as might happen with view ]
    what do you think ?

  • How to overcome view changes in bdc session method  using recording ?

    how to overcome view changes in bdc session method  using recording ?
    ex-for mm01 in recording if i selected views basic data1 and basic data2.
    i seheduleded for background for after 3 days .
    if any body changes views by selecting other views also.
    how to overcome this with out programming ?
    is there any settings ?

    Hi,
    I am attaching few threads.Hope these will help you.
    If there are any error records in session, all those error records will get poulated in log .SM35 and after the session is completed , u can see error records which can be corrected and reprocessed again
    We have the structures BDCLD and BDCLM, which will capture the log details inthe session. Firstly, sesssion should be processed. After that log will be created. Then caputure the information into an internal table using BDCLM and BDCLD.
    and refer the link.
    error correction in bdc session
    regards
    Madhu

Maybe you are looking for

  • How do I apply a transition to a group of clips?

    Hi, I want to apply a transition to a group of clips. I know how to select a group of clips, but I have not found how to apply the same transition on all of them. Can this be done in FCE?

  • HT1338 How do I install a hp Laserjet P1102w printer to a Macbook Pro with WiFi

    The hp Laserjet printer is plugged into the usb port of an IBM PC running Windows XP.  I would like to leave it thus connected.

  • Window 8.1 update on MackBook Pro. TrackPad Issues

    Hello will soneone help me please, I recently upgraded to Windows 8.1 from 8.0 on my MacBook Pro running Maveracks. Now the trackpad features no longer work.Before the upgrade I was able to do a two finger right click and scroll. Now at best I can mo

  • Missing OS problem

    I have installed Windows 7 and upgraded to Bootcamp 3.1. I booted back into Mac OS and then I attempted to boot back into Windows where I got the dreaded "Missing OS". Before anyone tells me to hit "option" or "shift" or "command" key to select an OS

  • Run/deploy on device (Asus eepad)

    Hi I want to deploy/run/debug to an Asus eePad but it is not listed as a connected device. I am using FB 4.5.1 and the tablet is running Android 3.1 and Air 2.6.0.1912 USB debugging is on and connected. I am using on OSX. could anyone offer a hint as