Binding for table produces list for other tables using foreign key and crea

Using
software Jdev 11G, WLS 11G, Oracle DB 11G, Windows Vista platform
technology EJB 3.0, jspx, backing beans, session bean
I cannot create a namedquery on my secondary table. The method for the column uses the entity object rather than the name and value of the column.
For instance,
(Coketruck) table has inventory records(Products) table
Coketruck has one to many to the Products table
Products has a many to one to the Coketruck
I need to return the products from the product table based on the CokeTruck but I cannot create a namedQuery because the method in the Product table is an entity object type instead of a long that I can use to look up all the products based off the column truck_id.
This is what I was expecting…
Private Long truckId;
public Long getTruckId() {
return truckId;
public void setTruckId (Long truckId) {
this. truckId = truckId;
Instead this is what I have…
@ManyToOne
@JoinColumn(name = "TRUCK_ID")
private Coketruck coketruck;
this. coketruck = coketruck
public Coketruck getCoketruck() {
return coketruck;
public void set Coketruck (Coketruck coketruck) {
this. coketruck = coketruck;
How do I do a query on the Product table to return all the products that are in the coketruck?
If I do the following it expects for me to pass the Entity Object which I cannot use as search criteria for my find method.
@NamedQuery(name = "Products.findById", query = "select o from Products o where o.truckId = :truckId")
On a different note but the same song…
I noticed that when I look at my Session Bean Data Contols that the coketruck already has a list of the products. I have created a jsp page with a backing bean and have been able to use the namedquery on the coketruck entity to retrieve the productList. Unfortunately I need to sort the products by type and was also not able to find where to perform the work to be able to iterate through the productList to get my desired display. Therefore I started looking at doing another namedquery that would only retrieve the product_type ordering by the truckId.
Seems I have come full circle… I don’t care what method I have to use to get the info back.
Any help is greatly appreciated!

user9005175 wrote:
Hi!
I work on an application wich uses a shopping cart stored in a database. The shopping cart uses two tables:
CART: Holds information common for one shopping cart: the user it is connected to etc.
- Primary key: CART_ID
CART_ROW: One row in the cart, e.g. one new product to buy.
- Primary key: ROW_ID
- Foreign key: CART_ROW.CART_ID references CART.CART_ID
From the code the rows in the cart are collected per cart, as is modelled by the foreign key. There exists one more relationship, which we use in the code, but which is not modelled by a foreign key in the database. One row can be dependent on another row, which makes the other row a parent.
CART_ROW has a column PARENT_ID which references CART_ROW.ROW_ID.
Should we add a foreign key for PARENT_ID? Or are there any questions to consider when it is a foreign key to the same table?
I suggest to add foreign key it wont harm the performance (except while on insert when there would be validation for the foreign key). But it would prevent users to insert wrong/corrupt data either through code or directly by loggin in the database.
A while ago we added indexes, both on ROW_ID and on PARENT_ID. Could the index on PARENT_ID have been harmful, since there is no foreign key?
Index on parent_id would only be harmful if you do not make use of index after creating it (i.e. there is no query which make use of this index).
And if you decide to have a foreign key on parent_id then I suggest to have index too on parent_id as it would be helpful atleast when you delete any record in this table.
Best regards!

Similar Messages

  • Using FOreign key constraints on tables in database.

    I am student and novice in the field of ORACLE and PL/SQL and Database Creation. I had created a database consisting tables and got problem while applying foreign key constraints.
    CUST_MSTR
    CREATE TABLE "DBA_BANKSYS"."CUST_MSTR"("CUST_NO" VARCHAR2(10),
    "FNAME" VARCHAR2(25), "MNAME" VARCHAR2(25), "LNAME" VARCHAR2(25),
    "DOB_INC" DATE NOT NULL,      "OCCUP" VARCHAR2(25), "PHOTOGRAPH" VARCHAR2(25),
    "SIGNATURE" VARCHAR2(25), "PANCOPY" VARCHAR2(1),      "FORM60" VARCHAR2(1));
    (CUST_NO is PRIMARY KEY, )
    -- EMP_MSTR
    CREATE TABLE "DBA_BANKSYS"."EMP_MSTR"("EMP_NO" VARCHAR2(10),
    "BRANCH_NO" VARCHAR2(10), "FNAME" VARCHAR2(25), "MNAME" VARCHAR2(25),
    "LNAME" VARCHAR2(25), "DEPT" VARCHAR2(30), "DESIG" VARCHAR2(30));
    (EMP_NO is primary key )
    --NOMINEE_MSTR
    CREATE TABLE "DBA_BANKSYS"."NOMINEE_MSTR"("NOMINEE_NO" VARCHAR2(10),
    "ACCT_FD_NO" VARCHAR2(10), "NAME" VARCHAR2(75), "DOB" DATE,
    RELATIONSHIP" VARCHAR2(25));
    (NOMINEE_NO is primary key )
    --ADDR_DTLS
    CREATE TABLE "DBA_BANKSYS"."ADDR_DTLS"("ADDR_NO" NUMBER(6),
    "CODE_NO" VARCHAR2(10),      "ADDR_TYPE" VARCHAR2(1), "ADDR1" VARCHAR2(50),
    "ADDR2" VARCHAR2(50), "CITY" VARCHAR2(25), "STATE" VARCHAR2(25),
    "PINCODE" VARCHAR2(6));
    ( ADDR_NO is primary key )
    Problem: I want to apply foreign key constraints on ADDR_DTLS table so that Before inserting value in ADDR_DTLS table it must check, VALUE in ADDR_DTLS.CODE_NO must be PRESENT either in attribute value CUST_MSTR.CODE_NO or EMP_MSTR.CODE_NO or NOMINEE_MSTR.CODE_NO table .
    I applied the foreign key constraints using this syntax
    CREATE TABLE "DBA_BANKSYS"."ADDR_DTLS"("ADDR_NO" NUMBER(6),
    "CODE_NO" VARCHAR2(10),      "ADDR_TYPE" VARCHAR2(1), "ADDR1" VARCHAR2(50),
    "ADDR2" VARCHAR2(50), "CITY" VARCHAR2(25), "STATE" VARCHAR2(25),
    "PINCODE" VARCHAR2(6),
    constraints fk_add foreign key CODE_NO references CUST_MSTR. CODE_NO,
    constraints fk_add1 foreign key CODE_NO references EMP_MSTR. CODE_NO,
    constraints fk_add2 foreign key CODE_NO references NOMINEE_MSTR.CODE_NO);
    (foreign key)
    ADDR_DTLS.CODE_NO ->CUST_MSTR.CUST_NO
    ADDR_DTLS.CODE_NO ->NOMINEE_MSTR.NOMINEE_NO
    ADDR_DTLS.CODE_NO ->BRANCH_MSTR.BRANCH_NO
    ADDR_DTLS.CODE_NO ->EMP_MSTR.EMP_NO
    When I applied foreign key constraints this way, its gives a error called foreign key constraints violation. (I understand that, its searches the attribute value of ADDR_DTLS.CODE_NO in all the three tables must be present then the value will be inserted. But I want, if the value is in any of the three table then its should insert the value or its gives an error.)
    Please help me out, though i put the question and i want too know how to apply the forign key in this way. and is there any other option if foreign key implementation is not pssible.

    If you are on 11g you can use ON DELETE SET NULL:
    CREATE TABLE addr_dtls
    ( addr_no          NUMBER(6)  CONSTRAINT addr_pk PRIMARY KEY
    , addr_cust_no     CONSTRAINT addr_cust_fk    REFERENCES cust_mstr    ON DELETE SET NULL
    , addr_emp_no      CONSTRAINT addr_emp_fk     REFERENCES emp_mstr     ON DELETE SET NULL
    , addr_nominee_no  CONSTRAINT addr_nominee_fk REFERENCES nominee_mstr ON DELETE SET NULL
    , addr_type        VARCHAR2(1)
    , addr1            VARCHAR2(50)
    , addr2            VARCHAR2(50)
    , city             VARCHAR2(25)
    , state            VARCHAR2(25)
    , pincode          VARCHAR2(6) );In earlier versions you'll need to code some application logic to do something similar when a parent row is deleted, as otherwise the only options are to delete the dependent rows or raise an error.
    btw table names can be up to 30 characters and don't need to end with MSTR or DTLS, so for example CUSTOMERS and ADDRESSES might be more readable than CUST_MSTR and ADDR_DTLS. Also if the Customer/Employee/Nominee PKs are generated from a sequence they should be numeric.
    Edited by: William Robertson on Aug 15, 2010 6:47 PM

  • For the Attribute Movement type(BWA) we use Value " 201" and not "101" why?

    Hello Experts,
    We are in SRM 7.0 classic scenario,
    For the Attribute Movement type(BWA) we use Value " 201" and not "101" and provide the Source syst(backend R/3)
    Can you all plz help me understand what is the difference if use value "101" for the  Attribute Movement type(BWA)
    Also,can you all plz help me understand if we shd use value "101" or "201" for the  Attribute Movement type(BWA) and under what scenario.
    Any pointers will be highly appreciated.
    Thanks & Regards,
    RKS

    Hi,
    Movment type " 201 maintained for the Classic scenario only.
    It is necessary to maintain the attribute if the default material group for a given user (or) sit is set to a backend logical system. The EBP system knows that if the user is set for backend procurement ,that there might be a possibility for a reservation to be generated therefore it checks to see that a value for this attribute is  maintained. The BWA value should be defined  for the  as 201 preceeded by the logical system and a backslash.
    101 should not be used. This isfor the Good receipt.
    In the extended classic scenario when you do the confirmations in SRM the movement type 101 will be created in the
    backend system (R/3 or ECC6.0)
    Regards
    Ganesh Kumar .G

  • Find which tables are linked to this one via foreign keys

    Hi, I need to drop & recreate a table, but this table is referenced by other tables via foreign key constraints.
    1. Is there a query I can run to find those tables (the ones referencing this one) ?
    2. What is the standard way to drop & recreate this table being referenced by others?

    1) You can try the following query:
    select r.owner, r.table_name
    from user_constraints r, user_constraints o
    where r.r_owner = o.owner and r.r_constraint_name = o.constraint_name
    and o.constraint_type in ('P','U') and r.constraint_type = 'R'
    and o.table_name = 'DEPT'
    2) To drop tables with references you can also use drop table cascade constraints,
    which will also drop constraints from tables:
    [email protected]> drop table dept;
    drop table dept
    ERROR at line 1:
    ORA-02449: unique/primary keys in table referenced by foreign keys
    [email protected]> drop table dept cascade constraints;
    Table dropped.
    Another way is to prepare a script which will remove the tables in proper order.
    Best Regards
    Krystian Zieja / mob

  • Displaying information other than a foreign key in 'interactive reports'

    I would be very grateful if someone could help with the following query. I have 2 tables (*Table1* and Table2). Table1 has the following columns:-
    Tbl1PrimaryKey, Tbl1Description
    Table2 has the following columns:-
    Tbl2PrimaryKey, Tbl2Description, Tbl1ForeignKey
    Where Tbl1PrimaryKey is the 'primary key' in Table1, Tbl2PrimaryKey is the 'primary key' in Table2 and Tbl1ForeignKey is a 'foreign key' and uses the 'primary key' from Table1.
    I would like to create a page which displays the description of Table2 and Table1 on a web page, however, using an 'interactive report' in APEX, the resulting web page displays:-
    Tbl2PrimaryKey, Tbl2Description, Tbl1ForeignKey
    I would like to change the underlying code to display Tbl1Description instead of the primary key, but I can't get the SQL coding correct. The region source sql code at present is:-
    select "Tbl2PrimaryKey",
    "Tbl2Description",
    "Tbl1ForeignKey"
    from "#OWNER#"."Table2"
    Any help regarding the above query will be appreciatiated.

    Try one of the following in the Source:
    in-line query...(My favorite)
    select "Tbl2PrimaryKey",
    "Tbl2Description",
    (select Tbl1Description from Table1 where "Table2"."Tbl1ForeignKey" = Table1.Tbl1PrimaryKey) Tbl1Description
    from "#OWNER#"."Table2"
    -or-
    Classic Join (if Tbl1ForeignKey is NOT NULL)
    select "Tbl2PrimaryKey",
    "Tbl2Description",
    Tbl1Description
    from "#OWNER#"."Table2", Table1
    where "Table2"."Tbl1ForeignKey" = Table1.Tbl1PrimaryKey
    Hope that helps,
    Russ

  • How do I transfer music from one iPhone to the other without using a laptop and will I be billed?

    How do I transfer music from one iPhone to the other without using a laptop and will I be billed?

    Download Past Purchases
    http://support.apple.com/kb/HT2519
    Or do you mean this...
    Old Phone to New Phone
    http://support.apple.com/kb/HT2109
    Also...
    It should be Noted that anything Downloaded with a Particular Apple ID is tied to that Apple ID and Cannot be Merged or Transferred to a Different Apple ID

  • Fact table is joining with Other table having values for measures

    I have one Fact table named Fact1 where i am going to create some calculation measures based on the values in Table2.
    How should be the physical join between them and the logical join.
    Earlier we had those VALUES in Fact1 only
    Why we created table Table2 is there was bit confusion for the aggregation in Fact1.
    We are bit confused on whether to make Table2 as dimension or Fact as it is having some measures and not having the foreign keys
    How we have to proceed now..!! Please help us!!?

    I have one Fact table named Fact1 where i am going to create some calculation measures based on the values in Table2.
    How should be the physical join between them and the logical join.
    Earlier we had those VALUES in Fact1 only
    Why we created table Table2 is there was bit confusion for the aggregation in Fact1.
    We are bit confused on whether to make Table2 as dimension or Fact as it is having some measures and not having the foreign keys
    How we have to proceed now..!! Please help us!!?

  • To populate dynamically created int table with data from other table

    Hi everybody,
    I have already created an internal table dynamically, but now want to populate it with data from another IT depending on the plant name.
    My dynamic int table contains fields with plant name like '8001' ,'8002' and so on.
    no I want to read data from the other table and depending on bwkey which contains similar data like plant name , want to append to this new dynamic int table through read key statement.
    I cannot reference the field name hard coded as it does not allow field symbol reference to be hard coded.
    Pls help.

    Hi,
    Check the code below:
    REPORT  ztestdyn.
    TYPE-POOLS : slis.
    TABLES: yyle0003.
    DATA:
      g_exit    TYPE c,
      g_save    VALUE 'A',               "For parameter I_SAVE
      g_repid   LIKE sy-repid,           "For program name
      g_variant TYPE disvariant.         "For parameter IS_VARIANT
    *Tables
      DATA: d_ref TYPE REF TO data,
            d_ref1 TYPE REF TO data,
            i_alv_cat1 TYPE TABLE OF lvc_s_fcat,
            ls_alv_cat1 LIKE LINE OF i_alv_cat1.
      DATA: BEGIN OF total_tab OCCURS 0 ,
            tknum TYPE yyle0003-tknum,
            quantity TYPE p,  "yyle0003-QUANTITY,
            END OF total_tab.
      DATA: BEGIN OF g_scandata_tab OCCURS 0.
              INCLUDE STRUCTURE yyle0003.
      DATA: END OF g_scandata_tab.
      DATA: g_yyle0003_tab LIKE yyle0003 OCCURS 0 WITH HEADER LINE.
      DATA: g_itab1 TYPE TABLE OF yyle0003.
      DATA: wa_itab1 LIKE g_scandata_tab.
      TYPES: BEGIN OF itab2,
             tknum TYPE yyle0003-tknum,
             vhilm TYPE yyle0003-vhilm,
             quantity TYPE p,
             END OF itab2.
      DATA: g_itab3 TYPE TABLE OF itab2.
      DATA: wa_itab3 TYPE itab2.
      DATA: g_itab5 TYPE TABLE OF itab2.
      DATA: wa_itab5 TYPE itab2.
      DATA: g_itab4 TYPE TABLE OF itab2.
      DATA: wa_itab4 TYPE itab2.
      DATA: gv_wa TYPE REF TO data.
      DATA : wa_tab TYPE itab2.
      DATA: BEGIN OF itab6 OCCURS 0,
             vhilm TYPE yyle0003-vhilm,
             quantity TYPE p,
             END OF itab6.
    ******************Start of Internal Table Definition *******************
      DATA:
            g_custom_container_0100 TYPE REF TO cl_gui_custom_container,
            g_alv_grid_0100    TYPE REF TO cl_gui_alv_grid,
            g_container_0100   TYPE scrfname VALUE 'LIST',
            g_mylayout         TYPE lvc_s_layo,
            ok_code            LIKE sy-ucomm.
      FIELD-SYMBOLS :<f_fs> TYPE table,
                     <f_fs11> TYPE table,
                     <f_fs1> TYPE table,
                     <f_fs3> TYPE ANY,
                     <f_fs4> TYPE ANY,
                     <f_field> TYPE ANY,
                     <f_fs5> TYPE ANY.
      FIELD-SYMBOLS: <fs_wa> TYPE ANY.
      DATA: l_var TYPE i,
            l_i   TYPE i.
      DATA: l_var1 TYPE char20,
            l_var2 TYPE char20.
    DATA: l_TOTAL TYPE I,
          L_FILL TYPE i,
          L_TOT  TYPE I.
    DATA: l_int TYPE i,
           l_sum TYPE i.
    FIELD-SYMBOLS: <f_fs2> TYPE  itab2, "
                     <f_fs6> TYPE ANY,
                     <f_fs7> TYPE ANY.
      DATA: l_var3 TYPE char15.
      DATA: l_quant TYPE p.
    FIELD-SYMBOLS: <f_fs8> LIKE itab6, "
                     <f_fs9> TYPE ANY,
                     <f_fs10> TYPE ANY.
    FIELD-SYMBOLS : <f_fs12> TYPE ANY,
                      <f_fs13> TYPE ANY.
      SORT g_scandata_tab BY tknum vhilm.
      LOOP AT g_scandata_tab INTO wa_itab1.
        MOVE-CORRESPONDING wa_itab1 TO wa_itab3.
        APPEND wa_itab3 TO g_itab3.
      ENDLOOP.
      LOOP AT g_itab3 INTO wa_itab3.
        COLLECT wa_itab3 INTO g_itab4.
      ENDLOOP.
      LOOP AT g_itab4 INTO wa_itab4.
        MOVE-CORRESPONDING wa_itab4 TO wa_itab5.
        MOVE-CORRESPONDING wa_itab4 TO itab6.
        APPEND wa_itab5 TO g_itab5.
        COLLECT itab6.
      ENDLOOP.
      CLEAR wa_itab3.
      SORT g_itab4 BY tknum vhilm.
      DELETE ADJACENT DUPLICATES FROM g_itab4 COMPARING vhilm.
      DESCRIBE TABLE g_itab4 LINES l_var.
      l_i = '2'.
      ls_alv_cat1-fieldname = 'TKNUM'.
      ls_alv_cat1-col_pos = 1.
      ls_alv_cat1-coltext ='ShipmentNo.'.
      APPEND ls_alv_cat1 TO i_alv_cat1.
      DATA: l_var4(10) TYPE c,
            l_var5(10) TYPE c,
            l_fieldname(20) TYPE c..
      LOOP AT g_itab4 INTO wa_itab4.
        IF l_var >= 1.
          CONDENSE wa_itab4-vhilm NO-GAPS.
          ls_alv_cat1-fieldname = wa_itab4-vhilm. "l_fieldname.
          ls_alv_cat1-col_pos = l_i.
          ls_alv_cat1-coltext = wa_itab4-vhilm.
          ls_alv_cat1-do_sum  ='X'.
          APPEND ls_alv_cat1 TO i_alv_cat1.
          CLEAR : ls_alv_cat1, l_fieldname.
          l_i = l_i + 1.
        ENDIF.
        AT LAST.
          ls_alv_cat1-fieldname = 'TOTAL'. "l_fieldname.
          ls_alv_cat1-col_pos = l_i.
          ls_alv_cat1-coltext = 'TOTAL'.
          ls_alv_cat1-do_sum  ='X'.
          APPEND ls_alv_cat1 TO i_alv_cat1.
          CLEAR : ls_alv_cat1, l_fieldname.
        ENDAT.
        SORT i_alv_cat1 BY fieldname.
        DELETE ADJACENT DUPLICATES FROM i_alv_cat1.
      ENDLOOP.
      SORT i_alv_cat1 BY col_pos.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = i_alv_cat1
        IMPORTING
          ep_table = d_ref.
      ASSIGN d_ref->* TO <f_fs>.
      CREATE DATA gv_wa LIKE LINE OF <f_fs>.
      ASSIGN gv_wa->* TO <fs_wa>.
      DELETE ADJACENT DUPLICATES FROM <f_fs> COMPARING ALL FIELDS.
        LOOP AT itab6.
        CLEAR wa_itab5.
        wa_itab5-tknum = 'Total'.
        MOVE-CORRESPONDING itab6 TO wa_itab5.
        APPEND wa_itab5 TO g_itab5.
        CLEAR wa_itab5.
      ENDLOOP.
         DESCRIBE TABLE g_itab5 LINES L_TOT.
           LOOP AT TOTAL_TAB.
          L_TOTAL = L_TOTAL + total_tab-quantity.
         ENDLOOP.
      LOOP AT g_final ASSIGNING <f_fs2>.
        ASSIGN COMPONENT 'TKNUM' OF STRUCTURE <f_fs2> TO <f_fs6>.
        ASSIGN COMPONENT 'TKNUM' OF STRUCTURE <fs_wa> TO <f_fs7>.
        <f_fs7> = <f_fs6>.
        CONDENSE <f_fs2>-vhilm NO-GAPS.
        ASSIGN COMPONENT 'VHILM' OF STRUCTURE <f_fs2> TO <f_fs3>.
        ASSIGN COMPONENT 3 OF STRUCTURE <f_fs2> TO <f_fs4>.
        MOVE <f_fs3> TO l_var1.
        ASSIGN COMPONENT l_var1 OF STRUCTURE <fs_wa> TO <f_fs5>.
        <f_fs5> =  <f_fs4>.
        CLEAR total_tab-quantity.
        READ TABLE total_tab WITH KEY tknum = <f_fs6>.
        IF sy-subrc = 0.
          ASSIGN total_tab-quantity TO <f_fs12>.
          ASSIGN COMPONENT 'TOTAL' OF STRUCTURE <fs_wa> TO <f_fs13>.
          <f_fs13> = <f_fs12>.
        ENDIF.
        L_FILL = L_FILL + 1.
        IF L_FILL = L_TOT.
         ASSIGN L_TOTAL TO <f_fs12>.
          ASSIGN COMPONENT 'TOTAL' OF STRUCTURE <fs_wa> TO <f_fs13>.
          <f_fs13> = <f_fs12>.
        ENDIF.
        AT END OF <f_fs2>-tknum.
          APPEND <fs_wa> TO <f_fs>.
          CLEAR  <fs_wa>.
        ENDAT.
      ENDLOOP.
      CLEAR: <f_fs6>,
              <f_fs7>.
      CLEAR <fs_wa>.
    CALL SCREEN 0100.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'ZVKS'.
      SET TITLEBAR 'ZVKS'.
      CHECK sy-ucomm IS INITIAL.
      SORT g_scandata_tab BY tknum vhilm.
      CREATE OBJECT g_custom_container_0100
             EXPORTING container_name = g_container_0100
             EXCEPTIONS
               cntl_error = 1
               cntl_system_error = 2
               create_error = 3
               lifetime_error = 4
               lifetime_dynpro_dynpro_link = 5.
      CREATE OBJECT g_alv_grid_0100
             EXPORTING i_parent = g_custom_container_0100.
      g_mylayout-grid_title = 'Display Scanning data'.
      CALL METHOD g_alv_grid_0100->set_table_for_first_display
        CHANGING
          it_outtab                     = <f_fs>
          it_fieldcatalog               = i_alv_cat1
                    EXCEPTIONS
                      invalid_parameter_combination = 1
                      program_error                 = 2
                      too_many_lines                = 3
                      OTHERS                        = 4.
      IF sy-subrc <> 0.
                  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    Regards
    Kannaiah

  • Insert into one table by query from other table

    Dear sir, i have inserted in to Table A as below:
    ROLE_ID
    USER_ID
    AUTH_STAT
    BRANCH_CODE
    Teller1
    Phearom
    A
    001
    Teller2
    Phearom
    A
    001
    I want to insert the same more value for field ROLE_ID, USER_ID and AUTH_STAT, except BRANCH_CODE must change. Value of field BRANCH_CODE in can query form Table B.
    Kindly give me some idea.
    Thank and Regard.
    Phearom

    7d8870ae-222b-4d73-8251-86f34b1ad49e wrote:
    Dear sir, i have inserted in to Table A as below:
    ROLE_ID
    USER_ID
    AUTH_STAT
    BRANCH_CODE
    Teller1
    Phearom
    A
    001
    Teller2
    Phearom
    A
    001
    I want to insert the same more value for field ROLE_ID, USER_ID and AUTH_STAT, except BRANCH_CODE must change. Value of field BRANCH_CODE in can query form Table B.
    Kindly give me some idea.
    Thank and Regard.
    Phearom
    You don't seem to have taken any notice of the advice given in your last thread: Insert multi row
    about reading Re: 2. How do I ask a question on the forums?
    and following the advice there.
    In fact, I suspect this is just another thread on the same problem.
    Unless you give us the information required, we can't really help

  • Error while uploading .xml file for Customer/Vendor List for Italy

    Hi All,
    We are facing problem while uploading the .xml file in DMEE transaction for the new Customer/Vendor List for Italy.
    We have followed the entire process given in the OSS Note(1090857).
    We have SAP 4.6c and followed the below steps:
    1. Created ID-FI-IT Development class
    2. Added domains
    3. Added Data elements
    4. Tried to upload the given .xml file and got any error saying ".xml file could not be interpreted".
    Also there is a .SAR file mentioned to upload if we receive any errors while uploading .xml file.
    Tried uploading the .SAR file also. STill we are recieving the same Error.
    Can any one of you help us out.
    Thanks in Advance.
    Ramesh

    Ok, we upload .SAR file in this way:
    1. unpack .SAR file with SAPCAR.EXE program. Yuo obtain 2 files
    R492445.P9C and K492445.P9C
    2. put K492445.P9C in directory \SAPMNT\TRANS\COFILES and put R492445.P9C in directory \SAPMNT\TRANS\DATA of your system (DEV, TST or PRD)
    3. Use Tx STMS. If You want create DMEE tree in DEV system, go to DEV import queue. Choose menu Extras | Other requests | Add. Insert P9CK492445 in Transp. request field.
    4. Import the request. This creates the DMEE tree. You don't need ti upload XML file after. You can see the DMEE tree created with Tx DMEE and inserting
    Tree type        UMS1            
    Format tree     IT_CUST_VEN_LIST
    5. after continue follow the note
    I hope this help you
    Roberto

  • How to fetch column data using foreign key in adf table ?

    I have created a adf table using a view that has a group id and user id column. I want to display the user name ( from user table) and group name from group table. I had created view links to the corresponding tables from the user_group view ( whose iterator is used to render the table).
    It sort of works. I dragged the user name from the embedded user iterator in user_group iterator. It does find the correct user name but if I have more than one row, it displays the user name of the last row user in all rows !
    Is there a solution to this problem ?

    Well, I saw in the view query for the association view ( for Many-Many) that the SQL already had the joins with the two ( master) tables to the association table. So I went ahead and added the descriptive columns to the select clause. Then the selected columns showed up in the attribute list by themselves ( without my intervention). So far so good.
    Then I recreated the adf table attribute by dragging these newly selected attribute to the page. I still see that the value of the attribute is the same in all the rows - this time it is the value for the FIRST row. It doesn't correspond to the foreign key for that particular row.
    IS THIS A BUG ? Has anyone else ever done this ?

  • Foreign Keys and import of tables (ORA-02297)

    How can i get all the foreign keys for a particular schema, basically i'm trying to import tables into a particular schema so i'm trying to disable the constraints, truncate the table , import data and then enable the constraints.
    but i'm having error like these when i disable all the constraints in this particular schema
    Table altered.
    alter table STANDINGS disable constraint P_STANDINGS
    ERROR at line 1:
    ORA-02297: cannot disable constraint (SCDAT.P_STANDINGS) - dependencies exist
    alter table STANDPMTS disable constraint P_STANDPMTS
    ERROR at line 1:
    ORA-02297: cannot disable constraint (SCDAT.P_STANDPMTS) - dependencies exist

    I use a dynamic SQL-Plus script to generate all the constraints for a schema. I then run this SQL to disable the constraints. Sometimes need to run the script more than once depending on the order the constraints are disabled. Once your scripts runs clean, then you can truncate your tables, import your data, and re-enable constraints.
    To re-enable, just use and editor to do REPLACE DISABLE WITH ENABLE....
    Here is sample of my dynamic sql. Needs to be run as SYSDBA...
    set heading off;
    spool c:\disable_constraints.sql;
    select 'ALTER TABLE ' || owner || '.' || table_name || ' DISABLE CONSTRAINT ' || constraint_name || ';'
    from dba_constraints
    where owner = '<owner_name>';
    spool off;
    Hope that helps..

  • How we relate two tables using foreign key(fk)?

    hi to all,
        what are the conditions has to follow to relate two tables.I.e.,
    the two tables have same primary keys(pk). if we relate these two tables in one table the pk and fk will be the same then how that table in active.

    Hi
    To relate two tables..we have foreign key relationship.
    In one table v have primary key and in the second table, the same key is foreign key for that table..
    To relate two tables, we can use JOINS
    If there is already a suitable foreign key between two tables used in the view, these tables can be linked with a join condition from this foreign key.
    Create a view on tables TAB1 and TAB2. TAB1 is the primary table of the view. TAB2 is the secondary table of the view. TAB1 is the check table for TAB2. The foreign key fields are assigned to the check table fields as follows:
    TAB1-FIELD_A assigned to TAB2-FIELD_1
    TAB1-FIELD_A assigned to TAB2-FIELD_1
    The join condition of the view generated from the foreign key is then:
    CREATE VIEW ... AS SELECT ... WHERE TAB2-FIELD_1 = TAB1-FIELD_A AND TAB2-FIELD_2 = TAB1-FIELD_B.
    Join conditions can also be copied from generic and constant foreign keys. If a constant is assigned to a field in the foreign key, it is also assigned to the field in the join condition. There is no join condition for a generic relationship in the foreign key.
    The foreign key between tables TAB1 (check table) and TAB2 (foreign key table) is defined as follows:
    TAB1-FIELD_A assigned to TAB2-FIELD_1
    TAB1-FIELD_B generic
    TAB1-FIELD_C assigned to constant ‘C’
    The join condition for the view generated from the foreign key is in this case:
    CREATE VIEW ... AS SELECT ... WHERE TAB2-FIELD_1 = TAB1-FIELD_A AND TAB2-FIELD_2 = ‘C’.
    Hope it helps
    Reward if useful.

  • Storage for Foreign Keys and Function based indexes

    This may well be the silliest question of the day, but is it possible to specify the storage for a Foreign key or a function based index? I'm not even sure that it would make sense.

    Well, a foreign key constraint is not a segment, nor is any other type of constraint. However, a function-based index is a segment, just like any other index. So, in that case, specify a tablespace, just like you would with any other index.
    Something like this:
    create index my_fbi on my_tab(upper(last_name)) tablespace my_index_tablespace;
    -Mark
    Message was edited by:
    mbobak
    Fixed minor typo.

  • Creating Column in table or use Foreign Key

    I have a bunch of tables that are year specific, so I need to store the year in the record. I'm not sure if I should create a column in each table called 'year' or create a master 'Year' table and use a foreign key to it in all my other tables. Any advice?
    PK_ID NUMBER Constraint pk1
    PRIMARY KEY
    YEAR VARCHAR2(4)
    --- or----
    PK_ID NUMBER Constraint pk1
    PRIMARY KEY
    FK_YEAR NUMBER Constraint fk_year
    REFERENCES year_table(PK_ID)

    Does your "year" entity have any attributes ?
    Why do you have a year, which to most people seems to be a number, stored as a varchar2(4) ? And what are you going to do about the Y10K problem ?
    How about making the ID of year the numeric value of the year you are storing - then you have eat your cake and have it ;)
    Seriously, though, why do you want a table to say that the year 2008 is the year identified by a meaningless unique number ?
    Regards
    Jonathan Lewis
    http:/jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk

Maybe you are looking for