Create object type from multiple tables for select statement

Hi there,
I have 3 tables as given below and I wish to create an object type to group selected columns as 'attribute' from multiple tables. 
I need to create 2 input parameters to pass in - 'attribute' and 'attribute value'  in PL/SQL and these 2 parameters will be
passing in with 'column name' and 'column value'.  e.g. 'configuration' - the column name, 'eval' - the column value.
Then, the PL/SQL will execute the select statement with the column and column value provided to output the record. 
Pls advise and thank you.
table ccitemnumber
name                           null     type                                                                                                   
ccitemnumber                   not null varchar2(20)                                                                                                                                                                                    
configuration                           varchar2(20)
item_type                               varchar2(30)
table productmodel
productmodelnumber             not null varchar2(6)                                                                                            
description                             varchar2(60)  
accesstimems                            number                                                                                                 
numberofheads                           varchar2(2)
generation                              varchar2(10)
numberofdiscs                           varchar2(2)
factoryapplication                      varchar2(150)
table topmodel
stmodelnumber                  not null varchar2(30)                                                                                           
productfamily                           varchar2(60
formfactor                              varchar2(10)                                                                                           
modelheight                             varchar2(10)                                                                                           
formattedcapacity                       number                                                                                                 
formattedcapacity_uom                   varchar2(20)
object type in database
configuration                           varchar2(20)
item_type                               varchar2(30)
numberofheads                           varchar2(2)
generation                              varchar2(10)
numberofdiscs                           varchar2(2)
factoryapplication                      varchar2(150)
modelheight                             varchar2(10)
formattedcapacity                       number                                                                                                 
formattedcapac

user12043838 wrote:
Reason to do this as these fields are required to be grouped together as they are created in different tables. They are treated as 'attribute' (consists of many columns) of the part number. So, the PL/SQL is requested to design in a way able for user to pass in the column name and column value or part number, then the select statement should be able to query for the records. Another reason is a new column can be added easily without keep modifying those effected programs. Reuseable too.This basically equates to ... hard to code, hard to maintain, and poor performance.
Are you really sure you want to do this? This isn't going to be easy-street as you seem to think it is, but it's a one way street to a poorly performing system with security vulnerabilities (google SQL Injection).
I would highly recommend you reconsider your design decision here.

Similar Messages

  • FETCHING VALUES IN MULTI RECORD BLOCK FROM ANOTHER TABLE USING SELECT STATEMENT.

    Hi,
    I have one multi record block in which i want to fetch values
    (more then one record) from another table using select statement
    IN KEY NEXT ITEM.I am getting following error.
    ORA-01422: exact fetch returns more than requested number of rows
    Thanks in advance.

    In your case I see no reason to use non-database block and to try to populate it from a trigger with a query, instead of using the default forms functionality where you can associate the block and the fields with table, create where clause using bind variables and simply use execute_query() build-in to populate the block. The power of the forms is to use their build-in functionality to interact with the database.
    Also, you can base your block on a query, not on a table and you dynamically change this query using set_block_property() build-in. You can use any dynamic queries (based on different data sources) and you simply need to control the column's data type, the number of the columns and their aliases. Something like creating inline views as a block data source.
    However, you can replace the explicit cursor with implicit one like
    go_block('non_db_block_name');
    first_record();
    FOR v_tab IN (SELECT *
    FROM tab
    WHERE col_name = :variable)
    LOOP
    :non_db_block_name.field1 := v_tab.col1;
    :non_db_block_name.field2 := v_tab.col2;
    next_record();
    END LOOP;

  • Creating a list from multiple tables

    Hi!
    Hopefully someone can help. I have a spreadsheet with 9 tables on it. I use this sheet to track different groups of volunteers based on departments. I have a separate table for each department. The  first table has a list of all of the volunteers. I currently fill in the names from each table on the the first table manually. I would like to be able to type a name into one of the tables and it auto populate on the first table. Is this possible or asking too much?
    Thanks for any help you can give me!

    Hi J,
    Turning the problem on its head, here is one approach. Start with two tables.
    The Department table is one cell. It will act as the trigger to filter rows in the Volunteers table.
    The Volunteers table contains the names of all volunteers. The order of names is alphabetical, but that may not be important in your aim. Column B contains dummy values for each Department.
    In the Volunteers table, select cells B2 to the bottom of the table. Format them as Pop-Up Menu.
    Delete Row 2 (it won't remove "All" from the Pop-Ups).
    Select and copy cell B2 and paste into the Department table so that it too becomes a Pop-Up.
    Using the Pop-Ups in the Volunteers table, assign a department to each volunteer:
    Now to set up Column C for the filter.
    Formula in C2 (and Fill Down) is:
    =IF(Department::A$1="All","Show",IF(B2=Department::A$1,"Show",""))
    Now select something other than All in the Department table
    Filter Rule on Column C ("Show"):
    To see this:
    You can hide columns B and C.
    To see the full list of volunteers again, choose All in the Department table
    Regards,
    Ian.
    Acknowledgment to t quinn for showing this filter idea in another thread. Ian.

  • Select from multiple tables without join statement

    Hey Gurus,
    I would like to make a select from a multiple tables to check if there is any reference to my data. I would like to do it with some elegancy, but I don't know how.
    Is in abap sql possible to do it only with the select statement?
    Or I was also think about a solution that I should fill some data structure with all of the tables which I want to select from and then just loop that data structure and do the select seperately from all of the tables. I just need to check if it founds some results, so no need to store it. If this solution would be fine what data structure should I use?
    Or can tell me what would be the best for this?
    My code for select from one table, which I want to make for multiple tables:
    SELECT SINGLE id_kniznice FROM zbr_t_autori INTO wa_id
           WHERE id_kniznice EQ ls_extract-zview-id_kniznice.
         IF sy-dbcnt > 0.
           MESSAGE i000(zbr_msgc_lib).
           ls_extract-flags-vim_mark = '*'.
           MODIFY extract FROM ls_extract.
    ENDIF.   
    Thank you for any posts.
    Regards,
    Robert

    And there we go again...
    Read this topic:
    For All Entries is NOT better than INNER JOIN in most cases
    And this one:
    inner join vs for all entries
    Also that one:
    Re: LOOP AT vs INNER JOIN
    JOINs are really better than for all entries in most cases. Problem is people tend to ignore basic things like using pks or indexes while making them.

  • Building index from multiple tables for text search

    Hallo,
    I had a look at how to build a index table to optimize search with Oracle text.
    At the moment we are using a JOIN of tables to search for a text in several fields located in different tables.
    My question is:
    Is it possible to create that index table from several tables?
    If yes, can you point me out to any links or give me an example.
    So far, all the examples I read were about 1 table only.
    Thanks
    Elisabeth

    The following is an extension of the original example. It uses ctx_ddl.sync_index to synchronize the index and shows the changes in one of the index tables and shows that the query finds the newly synchronized data. It also shows how this only happens when the column that the index is on is updated. In this example, the index is on the dummy column. The first update does not update the dummy column, so the ctx_ddl.sync_index command does not synchronize the new data. The second update does update the related dummy column, so ctx_ddl.sync_index does synchronize the new data. Lastly, I showed what happens to one of the index tables when you rebuild the index. Notice the reduction in rows in the index table after the rebuild process. You could also rebuild online or drop and recreate the index.
    SCOTT@10gXE> DROP TABLE addresses
      2  /
    Table dropped.
    SCOTT@10gXE> DROP TABLE customers
      2  /
    Table dropped.
    SCOTT@10gXE> CREATE TABLE customers
      2    (customer_id NUMBER,
      3       first_name  VARCHAR2(15),
      4       last_name   VARCHAR2(15),
      5       dummy         VARCHAR2(1),
      6    CONSTRAINT   customers_pk PRIMARY KEY (customer_id))
      7  /
    Table created.
    SCOTT@10gXE> CREATE TABLE addresses
      2    (customer_id NUMBER,
      3       street         VARCHAR2(15),
      4       city         VARCHAR2(15),
      5       state         VARCHAR2(2),
      6    CONSTRAINT   addresses_fk FOREIGN KEY (customer_id)
      7                REFERENCES customers (customer_id))
      8  /
    Table created.
    SCOTT@10gXE> GRANT SELECT ON customers TO ctxsys
      2  /
    Grant succeeded.
    SCOTT@10gXE> GRANT SELECT ON addresses TO ctxsys
      2  /
    Grant succeeded.
    SCOTT@10gXE> CONNECT CTXSYS/ctxsys_password
    Connected.
    CTXSYS@10gXE>
    CTXSYS@10gXE> CREATE OR REPLACE PROCEDURE concat_cols
      2    (p_rowid IN     ROWID,
      3       p_clob     IN OUT CLOB)
      4  AS
      5    v_clob            CLOB;
      6  BEGIN
      7    FOR c1 IN
      8        (SELECT customer_id, first_name || ' ' || last_name AS data
      9         FROM      scott.customers
    10         WHERE  ROWID = p_rowid)
    11    LOOP
    12        v_clob := v_clob || c1.data;
    13        FOR c2 IN
    14          (SELECT ' ' || street || ' ' || city || ' ' || state AS data
    15           FROM   scott.addresses a
    16           WHERE  a.customer_id = c1.customer_id)
    17        LOOP
    18          v_clob := v_clob || c2.data;
    19        END LOOP;
    20    END LOOP;
    21    p_clob := v_clob;
    22  END concat_cols;
    23  /
    Procedure created.
    CTXSYS@10gXE> SHOW ERRORS
    No errors.
    CTXSYS@10gXE> GRANT EXECUTE ON concat_cols TO scott
      2  /
    Grant succeeded.
    CTXSYS@10gXE> CONNECT scott/tiger
    Connected.
    SCOTT@10gXE>
    SCOTT@10gXE> EXEC CTX_DDL.DROP_PREFERENCE ('concat_cols_datastore')
    PL/SQL procedure successfully completed.
    SCOTT@10gXE> BEGIN
      2    CTX_DDL.CREATE_PREFERENCE ('concat_cols_datastore', 'USER_DATASTORE');
      3    CTX_DDL.SET_ATTRIBUTE ('concat_cols_datastore', 'PROCEDURE', 'ctxsys.concat_cols');
      4  END;
      5  /
    PL/SQL procedure successfully completed.
    SCOTT@10gXE> CREATE INDEX customer_text_idx ON customers (dummy)
      2  INDEXTYPE IS CTXSYS.CONTEXT
      3  PARAMETERS ('datastore concat_cols_datastore')
      4  /
    Index created.
    SCOTT@10gXE> INSERT INTO customers VALUES (1, 'Bob', 'Smith', NULL)
      2  /
    1 row created.
    SCOTT@10gXE> INSERT INTO addresses VALUES (1, 'Noplace', 'Nowhere', 'CA')
      2  /
    1 row created.
    SCOTT@10gXE> INSERT INTO customers VALUES (2, 'Bob', 'Jones', NULL)
      2  /
    1 row created.
    SCOTT@10gXE> INSERT INTO addresses VALUES (2, 'Smith St.', 'Somewhere', 'CA')
      2  /
    1 row created.
    SCOTT@10gXE> EXEC CTX_DDL.SYNC_INDEX ('customer_text_idx')
    PL/SQL procedure successfully completed.
    SCOTT@10gXE> COLUMN   token_text FORMAT A30
    SCOTT@10gXE> SELECT   token_text, token_type, token_first, token_last, token_count
      2  FROM     dr$customer_text_idx$i
      3  /
    TOKEN_TEXT                     TOKEN_TYPE TOKEN_FIRST TOKEN_LAST TOKEN_COUNT
    BOB                                     0           1          2           2
    CA                                      0           1          2           2
    JONES                                   0           2          2           1
    NOPLACE                                 0           1          1           1
    NOWHERE                                 0           1          1           1
    SMITH                                   0           1          2           2
    SOMEWHERE                               0           2          2           1
    ST                                      0           2          2           1
    8 rows selected.
    SCOTT@10gXE> SELECT   c.first_name, c.last_name, a.street, a.city
      2  FROM     customers c, addresses a
      3  WHERE    c.customer_id = a.customer_id
      4  AND      CONTAINS (C.dummy, 'Smith') > 0
      5  /
    FIRST_NAME      LAST_NAME       STREET          CITY
    Bob             Smith           Noplace         Nowhere
    Bob             Jones           Smith St.       Somewhere
    SCOTT@10gXE> -- dummy is not updated, so the index is not synchronized:
    SCOTT@10gXE> UPDATE   addresses
      2  SET      city = 'Anywhere'
      3  WHERE    city = 'Somewhere'
      4  /
    1 row updated.
    SCOTT@10gXE> EXEC CTX_DDL.SYNC_INDEX ('customer_text_idx')
    PL/SQL procedure successfully completed.
    SCOTT@10gXE> SELECT   token_text, token_type, token_first, token_last, token_count
      2  FROM     dr$customer_text_idx$i
      3  /
    TOKEN_TEXT                     TOKEN_TYPE TOKEN_FIRST TOKEN_LAST TOKEN_COUNT
    BOB                                     0           1          2           2
    CA                                      0           1          2           2
    JONES                                   0           2          2           1
    NOPLACE                                 0           1          1           1
    NOWHERE                                 0           1          1           1
    SMITH                                   0           1          2           2
    SOMEWHERE                               0           2          2           1
    ST                                      0           2          2           1
    8 rows selected.
    SCOTT@10gXE> SELECT   c.first_name, c.last_name, a.street, a.city
      2  FROM     customers c, addresses a
      3  WHERE    c.customer_id = a.customer_id
      4  AND      CONTAINS (C.dummy, 'Anywhere') > 0
      5  /
    no rows selected
    SCOTT@10gXE> -- once dummy is updated, the index is synchronized:
    SCOTT@10gXE> UPDATE   customers
      2  SET      dummy = NULL
      3  WHERE    customer_id = 2
      4  /
    1 row updated.
    SCOTT@10gXE> EXEC CTX_DDL.SYNC_INDEX ('customer_text_idx')
    PL/SQL procedure successfully completed.
    SCOTT@10gXE> SELECT   token_text, token_type, token_first, token_last, token_count
      2  FROM     dr$customer_text_idx$i
      3  /
    TOKEN_TEXT                     TOKEN_TYPE TOKEN_FIRST TOKEN_LAST TOKEN_COUNT
    BOB                                     0           1          2           2
    CA                                      0           1          2           2
    JONES                                   0           2          2           1
    NOPLACE                                 0           1          1           1
    NOWHERE                                 0           1          1           1
    SMITH                                   0           1          2           2
    SOMEWHERE                               0           2          2           1
    ST                                      0           2          2           1
    ANYWHERE                                0           3          3           1
    BOB                                     0           3          3           1
    CA                                      0           3          3           1
    JONES                                   0           3          3           1
    SMITH                                   0           3          3           1
    ST                                      0           3          3           1
    14 rows selected.
    SCOTT@10gXE> SELECT   c.first_name, c.last_name, a.street, a.city
      2  FROM     customers c, addresses a
      3  WHERE    c.customer_id = a.customer_id
      4  AND      CONTAINS (C.dummy, 'Anywhere') > 0
      5  /
    FIRST_NAME      LAST_NAME       STREET          CITY
    Bob             Jones           Smith St.       Anywhere
    SCOTT@10gXE> -- notice the changes if the index is rebuilt or dropped and recreated,
    SCOTT@10gXE> ALTER INDEX customer_text_idx REBUILD
      2  /
    Index altered.
    SCOTT@10gXE> SELECT   token_text, token_type, token_first, token_last, token_count
      2  FROM     dr$customer_text_idx$i
      3  /
    TOKEN_TEXT                     TOKEN_TYPE TOKEN_FIRST TOKEN_LAST TOKEN_COUNT
    ANYWHERE                                0           2          2           1
    BOB                                     0           1          2           2
    CA                                      0           1          2           2
    JONES                                   0           2          2           1
    NOPLACE                                 0           1          1           1
    NOWHERE                                 0           1          1           1
    SMITH                                   0           1          2           2
    ST                                      0           2          2           1
    8 rows selected.
    SCOTT@10gXE> SELECT   c.first_name, c.last_name, a.street, a.city
      2  FROM     customers c, addresses a
      3  WHERE    c.customer_id = a.customer_id
      4  AND      CONTAINS (C.dummy, 'Anywhere') > 0
      5  /
    FIRST_NAME      LAST_NAME       STREET          CITY
    Bob             Jones           Smith St.       Anywhere
    SCOTT@10gXE> 

  • Microsoft Access 2010 Creating a Form from Multiple Tables

    Hi.
    I am brand new to Microsoft Access and have had some exciting success making forms from single tables. This has made my data entry life much easier. However, I am continually stumped on one form I want to make. I would like to make a form that will let me
    update which brands retailers are selling. Most of this information is in my SalesHx table. However, my SalesHx table only uses RetailerID and BrandID to record history. The Brand's name (linked to a BrandID) is stored in my Brand Table and the Retailer name
    is stored in my Retailer table (linked to a RetailerID). I would like to be able to see the brand's name and the retailer's name when entering in data on a form, since I cannot remember the ids that associate with the names. I have been able to make a form,
    with a subform, that displays all of the information I want to see. When I update this form, though, with a new record, it invariably thinks that I am adding an entirely new record, not simply recording a new sales date for an already known brand. Even if
    I make the brand name a combo box that is limited to the fields on my table, this still happens. I will have BrandX as brand number 100 and as brand number 300 if I add it in through my sales history form. I am ready to throw access out the window. Can anyone
    offer advice?

     When I update this form, though, with a new record, it invariably thinks that I am adding an entirely new record, not
    simply recording a new sales date for an already known brand. 
    In what table is the SalesDate recorded?
    Build a little, test a little

  • Design Question: Creating One Object Type From Multiple Inputs

    Hi,
    I'm attempting to expand my brain a bit and come up with a more elegant solution to a design I created a few years ago. In simple terms, I have a data object (Request) which can be created based on data in a text file or from data previously persisted in a database record using the Request object and associated DAO. Typically, the text file is initiating a "new" Request object to be persisted, and reading from the database is done to update or view previously submitted Request objects. Note that I have no ability to change the original input method of the text file.
    In my original design I basically lumped everything into the Request class using multiple constructors which made for a messy jumble and a very long class. Different parsing routines were needed when data was read from the file vs. reading it from the database. I was considering refactoring the code to use a factory class but this doesn't seem to follow the typical Abstract Factory or Factory Method design patterns. In my design I keep ending up with something like:
    public class RequestFactory {
        public Request createRequestFromFile(File file) {...build up the request object...}
        public Request createRequestFromDbRecord(int recordId) {...build up the request object...}
    }And I would change the constructor in my Request class to private and remove all of the parsing and construction methods.
    Now, I can definitely make this work but I'm not sure I'm really doing much except taking the creation garbage (there's a lot of parsing of multiple-value fields that needs to be done) out of the actual Request class. So my question is basically, do I have a better approach I'm not seeing or is this type of factory "appropriate"? I mean, would someone come along later and look at my code and think I was crazy? I'm still trying to wrap my head around some ways to use factories in my own projects so I'm probably not thinking clearly.
    Thanks!
    Pablo

    Thanks for the feedback. About your suggestions on dealing with the different loading methods, I think that's where I keep getting disconnected, at least as far as using an abstract factory is concerned.
    Extending your example code a bit using option one, I would guess I end up with something like this:
    public interface RequestFactory {
      Request createRequest(RequestSource source) throws RequestCreationException;
    public class DatabaseRequestFactory implements RequestFactory {
      public Request createRequest(RequestSource source) throws RequestCreationException {
        // do some stuff
    }The part I can't figure out is how to define the RequestSource (or RequestId in your example). It would seem that if I'm going to define member variables in RequestSource like SourceFile or RecordId it would be just as correct to skip the interface and just use two concrete classes like this:
    public class FileRequestFactory {
      Request createRequest(File file) throws RequestCreationException {
        // process file and create request
    public class DatabaseRequestFactory {
      public Request createRequest(int recordId) throws RequestCreationException {
        // load record and create request
    }I guess where I keep stumbling is a) the value of the interface and b) if I do use an interface, how to have a generic object passed to createRequest() that can refer to either a file location or a record ID. This concept is pretty clear when the creation requirements for each concrete factory are the same, but when the construction uses such disparate data sources for creation I can't seem to wrap my head around the differences.
    Your third suggestion is probably the easiest for me to understand but it seems like it would be a bit contrived. In the end it may make the most sense if I am going to go with that type of approach since I still don't really understand how to implement the first two options.
    Thanks again for your input.
    Pablo
    Edited by: Pablo_Vadear on Dec 15, 2009 6:11 AM

  • Create a view from multiple tables

    Hi all,
    I am a newbie, so sorry if this is a "basic" question.
    I had 3 tables TAB1, TAB2 and TAB3
    TAB1 has
    STU_ID(pk), NAME, GRADE, ADDRESS
    TAB2 has
    COURSE_ID(pk), STU_ID(fk), COURSE_NAME, ROOM_NUM, TIME, DAY
    TAB3 has
    MENTOR_NAME, TITLE, AVAILABLE_DAYS
    Now I want to create a view(or query) that returns STU_ID, COURSE_NAME, NAME, GRADE, MENTOR_NAME and TITLE.
    When I tried writing a query like
    SELECT a.STU_ID, b.COURSE_NAME, a.NAME, a.GRADE, c.MENTOR_NAME, a.TITLE
    FROM TAB1 a, TAB2 b, TAB3 c
    WHERE a.STU_ID=b.STU_ID
    I am getting multiple results..like I'm getting Mentor name 4 times, name 4 times like that.
    So can anybody help me in writing the query for this....a "VIEW" would be appreciated.
    Thanks In Advance
    Srra

    You query should return all the columns in the select list once for each and every row that meets the specified join condition, how does this differ from what you are getting?
    So if tableA is the student table with only one row per student you would expect to see the student data duplicated once for every matching course row found in tableB, and so on when tableC is added in.
    If you need help please post partial results and then explain what results you want.
    HTH -- Mark D Powell --
    PS as sb mention you forgot your join condition to tableC which would multiply tableC by the other tables.
    Edited by: Mark D Powell on Feb 3, 2010 9:18 AM

  • Creating a datablock from multiple tables

    Hi
    I have a situation in which. There are two tables with the same set of columns and same names. when creating a block ,rows from both these tables have to populated into Form.
    (for example... One table represents expired details and the other one with valid details)
    Form accepts runtime parameters and displays the records. Any idea how to solve this. Please offer your suggestions
    Thanks
    null

    As ivar said if u create view and use then u cant update the values. One alternate solution is do manually. First of all why do u need to put both the base tables in a single block. Create 2 blocks corresponding to two expired and valid base tables. You can very well display both the information from 2 blocks in the same Form. Just get the user input and query manually. When u create two base table blocks Oracle will take care of the querying/inserting values from tables though both might have same column names. I hope this helps.

  • How to creat  Data source from Multiple Tables in   SAP  BI ?

    Hi Experts,
    1. For Finance & Payments MIS   tables are u2013   BSEG, BSIS,BSAS,PYAR ,BKPF
    2. For Inventory tables are           :           MSEG MKPF.
    3. For Invoices MIS   tables are  -          RBKP & RSEG.
    4. For Taxation MIS  tables  are u2013           J_1IEXCHDR, J_1IEXCDTL, J_1IPART2, J_1IPART1
    5. For Master data  tables  are   -    :         MARA, MAKT, LFA1, J_1IMTCHID
    How to creat   individual  Datasource  for   1.Finance & Payemnt Mis , 2. Inventory, 3. Invoices,  4. Taxation , 5. Mater data. ?

    Hi,
    Go for the generic data sources.
    1. first create the view on all the tables.
            You can only use join conditions but not Union.
            you can specify one table as primary table based on your requirement.
    2. build the data source based on the view.
    Regards,
    Siva
    Edited by: sivaramakrishna on Feb 2, 2012 3:54 PM

  • Delete records from multiple table

    Hi,
    I need to delete records from multiple tables using a single delete statement. Is it possible ? If so please let me know the procedure.
    Kindly Help.
    Thanks,
    Alexander.

    Hi Tim,
    Syntax of DELETE statement does not allow for multiple tables to be specified in this way. Infact, none of the DMLs allow you to specify table names like this.
    Technically, there are other ways of deleting from multiple tables with one statement.
    1. "Use a trigger":
    What was probably meant by this is that you have a driving-table on which you create a on-delete trigger. In this trigger, you write the logic for deleting from other tables that you want to delete from.
    This does mean a one-time effort of writing the trigger. But the actual DML operation of deleting from all the tables would be simply triggered by a delete on driving-table.
    2. Dynamic SQL:
    Write a PL/SQL code to open a cursor with table-names from which you want the data to be deleted from. In the cursor-for loop, write a dynamic SQL using the table-name to delete from that table.
    3. Using Foreign-Key constraint with Cascade-Delete:
    This I feel is a more 'cleaner' way of doing this.
    Having to delete data from multiple tables means that there is some kind of parent-child relationship between your tables. These relationships can be implemented in database using foreign-key constraints. While creating foreign-key constraint give the 'on delete cascade' clause to ensure that whenever data is deleted from parent-table, its dependent data is deleted from child-table.
    Using foreign-key constraint you can create a heirarchy of parent-child relationships and still your DELETE would be simple as you would only have to delete from parent-table.
    IMPORTANT: Implementing foreign-key constraints would also impact other DML operations that you should keep in mind.

  • How to create an Hierarchy from 2 tables in Essbase

    Hi,
    Currently We have 5 dimension tables and one fact table in Star Schema Model.We have requirement to create an hierarchy which pulls from multiple tables
    For Eg:
    Table:1 P1 P2
    Table:2 Q1 Q2
    Expected Hierarchy :
    P1
    Q1
    While we try to implement it shows inconsistent results.Can some one let me know the alterante solution to fulfill this requirement.
    Thanks,
    SatyaB

    Your JOIN doesn't work?
    You'd have to post what the tables look like, what you're joining on, etc., etc. You aren't supplying enough information.
    I am (to put it kindly) a SQL hack. I have found that if I go to a company's dba with my childlike SQL and ask, "Can you improve this?" almost 100% of the time they take pity on me and improve my code to no end. I know that's not what a dba is really for, but they tend to like well formed SQL touching their databases. Failing that, is there someone at your firm that is good with SQL who can help? You're on an Essbase board, not a SQL board, so you are likely not going to get the help you need here.
    Regards,
    Cameron Lackpour

  • ALV for fields from multiple tables and make them editable

    Hi,
    I am working on a forecasting report. We have created few custom table e.g. store forcaset detail for whole year month wise. tables are say sales data, budget data, forcast data etc.
    Now i need to make a report based on monthwise based on above mention table.
    eg.o/p looks like:
    column name                     type desc monthapr monthmay .......
    table forcast                      Qty  sales    100          150
    table budget/sales             amt   amou    20.50    130.50
    table sales vs forcast       amt   amount  3000     50000
    -Now i don't know how to display data from multiple table in single ALV list that to with different field type.
    -2nd issue is i need to make only perticuler row editable so that user can chage data.
    -3rd when user change data and press calulate button - it should calculate data for future month - i got formula for that and disply the calulated data.
    - 4th if user like the forcast data then when press save - change data should update dbtable.
    Is this all possible with simple abap FM Or need to use ABAPOO.
    I will appericiate all expert help.
    Many thanks in advance.
    KDE.
    Edited by: kde_test on Jun 4, 2010 5:44 PM

    Hi,
    Solutions :
    1. You can use  FM REUSE_ALV_HIERSEQ_LIST_DISPLAY as guided by Ashutosh.
    You can also check out this
    [http://www.sap technical.com/Tutorials/ABAP/3DGraph/demo.htm]  change link to saptechnical without space
    2. [How to make certain rows in ALV grid editable...;
    3 & 4. Use two importing paramaters 'PF_STATUS_SET' 'USER_COMMAND' of  REUSE_ALV_GRID_DISPLAY.
    create two function codes 'CALC and 'SAVE' in pf-status and provide your required functionality to these function codes using User-Command.
    Sorry am unable to provide you with supporting code, but you can search for it and It can solve your problem
    Regards,
    Rohit

  • Selecting from multiple tables, into one internal table

    Hi,
    What is the best & most efficient method of selecting from multiple table (in my case 6,) into one internal table?
    Thanks,
    John
    Points will be rewarded and all responses will be highly appreciated.

    I have simple example :
    First one - Join 5 tables
    data : f1 type i,
              f2 type i,
              f3 type i.
    start-of-selection.
    get run time field f1.
    write the query 4 or 5 tables join.
    get run time field f2.
    f3 = f2 - f1 ( Total time).
    Second one - joins 3 table and use for all entries
    data : f1 type i,
              f2 type i,
              f3 type i.
    start-of-selection.
    get run time field f1.
    write the query 3 tables join and use for all entries
    get run time field f2.
    f3 = f2 - f1. ( Total time )
    Finally you can have time diffrence between the both sql statement.

  • POWL accessing data from multiple tables/objects

    Hello,
    I have a query on the POWL applications.
    If the powl application has to access data from multiple tables/objects, then the solution would be creating a data structure of those tables/objects and referring to that structure in GET_OBJECT_DEF methods.
    Is there any other soln? or I am right here?
    The queries which are saved for a particular user are transportable? if not, how can they be made transportable?
    Thanks & regards,
    Ravish

    you are right, you can do in get_objects method.
    POWL_QUERIES are transportab;e, you can save them in POWL_QUERY transaction.
    Best regards,
    Rohit
    http://wiki.sdn.sap.com/wiki/display/WDABAP/POWL

Maybe you are looking for