Many to Many Form tutorial

Hi Guys,
I am looking for an online tutorial that will show me how to put something like this together...
Movie table: movie_id, name
Actor table: actor_id, first_name, last_name
Movie_Actor table: movie_id, actor_id
I would like an apex form screen with queriable section for the movie and a one for the actor. On commit, the form would create the link row.
Anyone know of a good online tutorial that covers this?
Cheers
Steve

Steve,
Could you include some more details about how you would want this to work? What do you mean when you say "queriable section"?
This could easily be accomplished with two pop up LOVs but I'm not sure if that's what you had in mind. As usual, if you put an example on apex.oracle.com and provide credentials we could help you a little easier.
Regards,
Dan
http://danielmcghan.us
http://sourceforge.net/projects/tapigen

Similar Messages

  • Portal Form for a Many to Many relationship

    I have 3 tables (well there are actually more but i'm glad when i can do the trick with 3 at the moment):
    T_JOURNAL (JOURNAL_ID, JOURNAL_NAME)
    T_CONTENTBROKER (CONTENTBROKER_ID, CONTENTBROKER_NAME)
    HT_JOURNAL_CONTENTBROKER (JOURNAL_ID, CONTENTBROKER_ID)
    The HT stants for 'help table'. T_JOURNAL and T_CONTENTBROKER have a many to many relationship. So one Journal can have many Broker and one Broker has many Journals.
    When doing a Form in Oracle Portal for adding a new Journal, i'd like to have a LoV with the Brokers. But an new entry would at least require 3 tables to update (T_JOURNAL, T_CONTENTBROKER and the help table HT_JOURNAL_CONTENTBROKER). How can this be solved? i'm not very good with pl/sql... so if there is only a solution with pl/sql i would be glad for the code...
    I also tried to create a view wich would show me the journal with all its broker but i kind of failed...
    any suggestions appreciated ;)
    - renato

    Thanks for the info. I tried that and it still doesn't pull the value. I have opened a TAR via metalink, but I'm not getting any
    satisfactory answers. I ran across an note - 137172.1 that has this snippet of information in it.
    Unfortunately, at this time (portal 3.0.7.6.2) , a non-table item cannot be
    referenced in a plsql event handler, only in client side JavaScript code. This
    is a known limitation and will be fixed in a future release.
    I don't know how to get the value from the client side JavaScript code to a pl/sql variable. Do you?
    I've been trying to get them to tell me if the 'known issue' has been addressed in 3.0.9.
    I'll keep at it. Thanks so much for your suggestion I appreciate it.
    Deb

  • How to create a many to many relationship in forms 10g

    hello frnds,
    I want to create many to many relationship, can any one help me plz?
    Regards
    Divya Alok

    Hi ,
    In this situation create two separate blocks one is master and the other one is detail block.
    Then make detail block as database data block with the proper table name.Pass the value that your enter in the master block to the detail block as the search criteria to fetch the data from the table and to show the data related to the master value .If you have multiple master values then create data base data block sql query in such way that it must use all the master inputs as the search criteria.
    EX. Some time user wants to see the details of the employee after entering the emp id as the search criteria,that time you have to pass emp id as the search criteria to detail data base data block.Even you can pass emp id and emp name as the search criteria to the detail database data block.
    Thanks,
    Pavan.

  • Many to many displayed in list

    I'm developing a file manager where files have titles, descriptions, and subject categories amongst other things. File -> Subjects is a many to many relationship, linked by a file_subject table.
    I have successfully used the Many to Many Wizard to make the edit/update detail form work - which provides a Nested Repeat Region showing all subjects as checkboxes.
    Now I need to be able to display a list of all files, with one field listing all the many subject categories that a particular file belongs to. Is there a way to do this in ADDT? I can make a list with a nested repeat region showing the link table subjects, but don't know how to translate those to display values from the actual subject table. Does that make sense?
    Any assistance much appreciated.

    Hi Mick,
    with one field listing all the many subject categories that a particular file belongs to
    how do you store all those "subjects" in your comma-separated column, the "subject_id" I reckon ?
    However, you might want to read my little "Query-Tipp: extract 1 value from comma-separated list" tutorial I posted at the Interakt forums:
    http://www.interaktonline.com/Products/Dreamweaver-Extensions/MXWidgets/Product-Forum/Deta ils/54511/Query-Tipp%3A+extract+1+value+from+comma-separated+list.html
    Maybe this is what you´re looking for...
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Master - detail block (many-to-many)

    Hello, , I have 2 tables:
    1-(parts)its primary key : p_id
    2-(suppliers)its primary key : s_id
    and they have many-to-many relationship between them .
    the table Resulted from the relationship is(part_supp)
    How can I create master-detail block Based on this relationship.In other words, which of tables will be the master and which of them well be detail.
    I am using form 6i ..
    please help.....

    M3ATH wrote:
    Hello, , I have 2 tables:
    1-(parts)its primary key : p_id
    2-(suppliers)its primary key : s_id
    and they have many-to-many relationship between them .Many to many relation between two table isn't a good database design. You have to a junction table between them.
    the table Resulted from the relationship is(part_supp)Is this your junction table(part_supp) ?
    >
    How can I create master-detail block Based on this relationship.In other words, which of tables will be the master and which of them well be detail.If part_supp is your junction table between parts and suppliers then, try this..
    Use the junction table as a hidden block, then establish a standard Forms relation between
    Parts and (hidden)part_supp then between part_supp and suppliersHope this helps

  • ADF-Newbie.How can I create a many-to-many row from an action method?

    Hi all,
    First of all, this is my scenario:
    - JDeveloper 10.1.3.0.4
    - My application is running ADF + Faces + Toplink + EJB Facade
    - My database model includes some many-to-many relationships and some one-to-may relationships.
    I have developed several ADF pages displaying some CRUD operations over my master tables and my master-detail tables without any problem.
    I am now trying to implement some CRUDs over my many-to-many relationship tables.
    Lets call the tables involved as master1, master2, and relationship (the many-to-many table)
    Because usability reasons, my user wants me to implement an interface where he can:
    -Select a row from the master1 table
    -Select a row from the master2 table
    -Click a button called "Create relationship"
    I need to implement the code inside the action button to add my new record on the relationship table, and honestly, I have not found any clue.
    Please, give me some directions to solve my problem.
    Thank you in advance for your help...

    The key here is to work with the intersection table for your MtM relationship.
    The way I do it, is to have the user view Master Table I, and click on the add Relationship button, this button is a link to a add form for the Intersection Table. On the Add form, the MasterTable 1 Id is already filled in and I hide it. I then setup MasterTable 2 as an LOV on the page. The used selects the item from the LOV and clicks on the commit button. I refresh my many-to-many view and all is grand.
    Using ADF/JSF, I have made it even nicer by turning the add relationship page into a dialog page, that way the user can see the previous page while adding the new relationship.
    Kelly

  • Many-to-Many CMR

    hi all,
    i defined two entity beans, Quiz and Question, with many-to-many cmr and
    a table named Quiz_questions_Question_quizesTable is created in the database after deployment process. the formed table columns consist of primary key of Quiz and primary key of Question, as expected. what i want to do is adding one more column to this table that shows the sequence number of the related question in the related quiz. is it possible? and how? or what should i do?
    thanks in advance..

    "what i want to do is adding one more column to this table that shows the sequence number of the related question in the related quiz."
    Makes sense, but then the association table is no longer just an association table.
    Perhaps a way to get you in the right frame of mind is, "how would you model this with just objects?"
    Basically a CMR just represents an association between two objects. You would see in your revised object model that you do not have a simple n-to-n association between a Quiz objects and a Question objects.[Quiz](0..n)---->(1..n)[Question]The above (bastardized UML) model does not represent the enumeration of Question objects within the scope of a single Quiz object.
    Perhaps the following is more accurate:[Quiz](1)---->(1..n)[QuizQuestion](0..n)---->(1)[Question]or                     [Question]
                              A
                              |
                              |
    [Quiz](1)---->(1..n)[QuizQuestion]It is only after you have your object model that you should worry about the entity bean stuff.

  • [ADF] Adding/deleting entries in a many-to-many relationship

    I am using JDeveloper 10.1.3 and the ADF BC / ADF Model / ADF Faces / JSF technology stack.
    For this question, I am using the SRDemo application as an example, specifically the many-to-many relationship between USERS and PRODUCTS (the Staff Expertise relationship), outlined in red in this schema diagram: Image Link
    Users may have any number of product expertise areas and many users may have the same product expertise area. For the purposes of this example I have added two reference fields from the PRODUCT table into the ExpertiseAreas VO (Name and Description), outlined in red in this data control palette section: Image Link
    I have created a page which shows the details of a user (1), along with a table showing the expertise areas the user has (3), and a table of all the products available (2), numbered on this design page: Image Link and corresponding to the numbered data controls on this data control palette section: Image Link, where 1 is rendered as an ADF Read-only Form, 2 is an ADF Read-only Table with a tableSelectMany element in the selection facet, and 3 is also an ADF Read-only Table.
    What I am trying to do is have the tableSelectMany element reflect which of the products are linked to the current user in the expertise areas relationship (by having the checkbox for currently linked products checked), and when you check or uncheck a product's checkbox, it should add or remove the row in the EXPERTISE_AREAS intersection table, respectively (asume for this example that there are default values for Expertise Level and Notes).
    So far I have been following the process used in section 19.8 of the ADF Developer's Guide for Forms/4GL Developers, which describes how to set up a selectManyShuttle which implements the adding and deleting functionality. So I have a Client Interface method in the Application Module, updateSkillsForCurrentStaff (described in section 10.6.7.2), and I have a selection listener for the assignment table in the backing bean for the page, which calls the updateSkillsForCurrentStaff method:
    public void selectionChanged(SelectionEvent event)
      BindingContainer bc = getBindings();
      DCIteratorBinding productsIB = (DCIteratorBinding)bc.get("ProductListIterator");
      Set keys = getTable1().getSelectionState().getKeySet();
      Iterator iter = keys.iterator();
      List productIds = new Vector();
      while (iter.hasNext())
        String product = ((Key)iter.next()).toStringFormat(true);
        productsIB.setCurrentRowWithKey(product);
        ViewRowImpl productRow = (ViewRowImpl)productsIB.getCurrentRow();
        Number productId = (Number)productRow.getAttribute("Id");
        productIds.add(productId);
      OperationBinding ob = bc.getOperationBinding("updateSkillsForCurrentStaff");
      Map pm = ob.getParamsMap();
      pm.put("productIds", productIds);
      ob.execute();
    All of this works, but I can't work out how to link the selection state of the assignment table to the expertise areas that are linked to the user. Also I think the method listing above must be a bit of a hack, but I don't know enough about this to know if there's an easier way of doing it.
    Any help is appreciated.

    Have a look at this example I cooked up for you.
    http://radio.weblogs.com/0118231/2006/10/03.html#a739
    It might not be the first way one thinks to implement something, but it illustrates a very interesting, model-centric approach to the problem you propose.
    My feelings won't be hurt if you prefer a more view-centric approach, but I wanted to illustrate what was a maximally-model-centric solution (in fact, which doesn't even require a backing bean!) If you like a more view-centric approach, I can help you figure out what's wrong with your key-handling above. For one, I would probably start by passing the Set of Key's directly to the middle tier application module method to eliminate client-side code.
    Check it out and let me know what you think. Try it directly in the Business Components Tester to appreciate one of the benefits a model-centric solution can bring.

  • Working with many-to-many relationships

    I am about to start my first experience with many-to-many
    relationships using PHP and MySQL.
    My project is to create an events registration form. As you
    know, there can be many events and many participants attending many
    events.
    I am not sure on how to structure my database and tables so I
    will first show you what I have:
    create table programs (
    program_id int not null primary key auto_increment,
    program_name varchar(100) not null,
    program_date varchar(25) not null,
    program_time varchar(25) not null,
    program_coordinator varchar(100),
    program_seats int not null
    create table participants (
    participant_id int not null primary key auto_increment,
    participant_name varchar(100) not null,
    participant_phone varchar(12) not null
    I know that I need a middle table to join the two.
    create table programs_participants (
    program_id int references program(id),
    participants_id int references participants(id),
    primary key (program_id, participants_id)
    My problem is, how do I submit to both the participants AND
    the programs_participants table together? Or is this not possible?
    The participants are not already in the database when we register
    them. We enter their personal info and select their desired events
    from checkboxes on the same page.
    Thanks for your help.

    > My problem is, how do I submit to both the participants
    AND the
    > programs_participants table together? Or is this not
    possible? The
    > participants are not already in the database when we
    register them. We
    > enter
    > their personal info and select their desired events from
    checkboxes on the
    > same
    > page.
    What you need to do is a multi-step insert.
    First, you insert the new participant into the participant
    table, then use
    the @@identity command to get the uniqueID of that newly
    entered record.
    Then you can take that uniqueID to build the entry for the
    programs_participants table.
    If you use a stored procedure, you should be able to do all
    of that with
    only having to create one call to the DB from your
    Application.
    _Darrel

  • Problem in Many-to-Many Associations (JBO-27014 error)

    I am facing a problem during insertion in an Intersection table.
    I have 3 tables Customer, Accounts and Customer_Account. In order to implement the Many to Many relationship between Customer and Accounts, I created an intersection table Customer_Account.
    Table Structure
    CUSTOMER
    Cust_id NUMBER NOT NULL PK
    Name VARCHAR2(50) NOT NULL
    ACCOUNT
    Account_Id NUMBER NOT NULL PK,
    Account_number NOT NULL,
    Sort_Code NUMBER NOT NULL,
    Account_Type VARCHAR2(10) NOT NULL
    CUSTOMER_ACCOUNT
    Cust_Id NUMBER NOT NULL,
    Account_Id NUMBER NOT NULL
    I created an Association CustAcctAsso between Customer and Account with Customer_Account as intersection entity. Then created a viewlink CustAcctViewLink with CustomerView as Source entity, AccountView as Destination entity and selected the CustAcctAsso as association.
    I included this in the application module using the following steps
    Selected AccountView via CustAcctViewLink in the Available view pane and selected CustomerView in Data model pane. Clicked > to add AccountView via CustAcctViewLink as a restricted view.
    Also added CustomerView via CustAcctViewLink as a restricted view.
    When I tried to insert data through the second restricted view I am getting an JBO 27014 Attribute Sort Code in Account is required.
    It would be very helpful if someone gives me a solution quickly.
    Thanks
    Renuka

    Thanks, now I am able to insert data into CUSTOMER and ACCOUNT table, but not in the intersection table.
    It seems that we cannot do any insertion into the intersection table. Please advice me, this is urgent.OK here's what you need to do to insert a new row in both ACCOUNT and INTERSECTION tables.
    1. Create a new viewobject with a join of INTERSECTION and ACCOUNT tables such that both are updateable but ACCOUNT is reference entity.
    -- This is assuming you want to insert a new account when you insert a new account id in the intersection table otherwise, you can make ACCOUNT entity readonly as well.
    2. Create a viewlink between Customer viewobject and this NewViewObject (1-* ViewLink).
    3. If the assumption in step 1 is NOT to update/insert new Accounts form this VO, then you're done. Add the new viewobject usage in your application module and you should be able to use it to edit/insert intersection details.
    Otherwise -
    Set the Updateable flag on AccountID (from the Account entity usage in the NewViewObject) to "never" udpateable.
    Set the Updateable flag on Other attributes from the Account entity usage in the NewViewObject to udpateable-while-new or always as desired.
    4. Select to generate EntityDefImpl subclass for Account table and override the protected method createInstance as below:
      protected EntityImpl createInstance(DBTransaction txn, AttributeList al)
        // TODO:  Override this oracle.jbo.server.EntityDefImpl method
        return super.createInstance(txn, al);
      }5. Select to generate a ViewRowImpl subclass with accessors for this NewViewObject
    6. Add the following logic in setAccountID() method (assuming AccountId attribute is editable and from Intersection entity)
    (Note you'll also have anothe attribute AccountId1 from Account entity which should be readonly as marked in step 3.)
    //get the current intersection entity.
    IntersectionImpl intersection = (IntersectionImpl)getEntity(1);
    setAttributeInternal(ACCOUNTID1, value);
    //if it is same as I added and is not the same as new one
    //framework may assign a new intersection entity based on FK.
    IntersectionImpl newIntersection = (IntersectionImpl)getEntity(1);
    IntersectionDefImpl intersectiondef = (IntersectionDefImpl)IntersectionImpl.getDefinitionObject();
    IntersectionEnrollmentImpl myVO = ((IntersectionEnrollmentImpl)getViewObject());
    DBTransaction dbtxn = myVO.getDBTransaction();
    //see if a intersection exists with this FK
    intersection = (IntersectionImpl)intersectiondef.findByPrimaryKey(dbtxn, IntersectionImpl.createPrimaryKey(value));
    //if this viewrow created a new intersection earlier which is different from
    //the current intersection entity, remove the old one as I created it.
    if ((intersectionAdded != null) && (intersection != intersectionAdded || newIntersection != intersectionAdded))
      if (intersection == null)
        //if I added this intersection as new, reuse-it.
        intersection = intersectionAdded;
        intersection.setIntersectionid(value);
      else
        //if I added this intersection as new, remove it.
        System.out.println(">>>>removing :"+intersectionAdded.getAttribute(0));
        intersectionAdded.remove();
        intersectionAdded = null;
    if (intersection == null)
      //if new intersection is null = no intersection exists with this key, then create a new one.
      intersection = (IntersectionImpl)intersectiondef.createInstance(dbtxn, new AttributeListImpl());
      intersection.setIntersectionid(value);
      intersectionAdded = intersection;
      setEntity(1, intersection);
      myVO.notifyRowUpdated(findRowSetForRow(this), new ViewRowImpl[]{this}, new int[]{2,3});
    else if (intersection != newIntersection)
      //otherwise, create a set the new intersection entity as my intersection entity reference
      setEntity(1, intersection);
      myVO.notifyRowUpdated(findRowSetForRow(this), new ViewRowImpl[]{this}, new int[]{2,3});
    }Now when you insert a new row in this NewViewObject, you can either enter a new Account or refer to an existing Account.
    The setAccountId() method will automatically bring the Account details for existing accounts or create a new Account entity as in the above logic.

  • How to handle Many-to-Many tables

    I have table_1 with a primary key, x
    I have table_2 with primary key y
    Table_3 represents the many-to-many relationship between table_1 and table_2, and has a primary key x,y.
    Okay - so I know how to set up master detail forms for table_1 and for table_2, but what type of form do I use for table_3? I want to use the primary key of table_1 as an item (:pagenum_x, I guess) and then select from a drop-down list for key y.
    I am am newbie, so if this is somewhere in the documentation (I can't find it after a few days trying), just tell me to keep looking. :)
    Norm

    Vojin,
    Thanks for the reply. It helps to have some corroboration when these types of issues come up.
    I can create regions or pages that handle the associations, but it seems as though I am fighting or fooling the product (APEX) to do so. Maybe adding the rowid with a sequence / trigger will simplify the design.
    Thanks,
    Norm

  • Inserting with many to many relationship

    db and dev 10g rel2 ,
    hi all ,
    an application for a laboratory ,( patients and tests)
    i think the relation here is (many to many) , because each patient can have multiple tests, and each test can
    have multiple patients .
    what tables should i create ?
    and finally i should have a block to insert data for patients , and it should have
    the name of the patient and the test he is doing .
    so what tables should i create , and the block for the data entry will be based on which table ? or tables ?
    thanks a lot

    Hi
    First i do strongly recommend collecting reports & forms papers which r filled out by Mrs employees & patients then u stay to decide by ur pen & formalize what r the data required & what type of relationship need to be contracted from scratch off course many modifications Will occure by it Will be easier to modify on papers.
    Then my guess is u.Will need tables for employees , Patients ,Labs & Analysis Types
    Employees & Patients fields in a table r common in ;name, id,address,birthday or age ,
    etc.
    Labs table is needed if only u have many labs types ...
    Analysis Types table is listing...
    Analysis_id , Analysis_name& comments if any...
    Actual_Analysis table which Will have many pk is from all previous tables e.g.
    employees_id,Analysis_id, Patient_id,Lab no
    ,Analysis_date,Delivery_date,
    Analysis time , Delivery or due time.
    Status +-- A flag Which indicates ethe delivery status done or not
    Deposit
    way payment -- can have a table for it.
    total cost
    taxes
    etc.
    --========
    All payments affairs could have a table or more for it
    hope it.helps as a start.
    Amatu Allah

  • Filtered many-to-many Assoc/Link?

    Hi,
    quite new to ADF (UIX) but already in serious trouble ;-)
    I have 3 Entity Objects: Items, Audiovisuals and Images which map to 3 (different!) Tables. Strictly speaking Audiovisuals and Images are SubTypes of generell Items. But I decided not to implement the super-class-sub-class on entity level but on view level instead.
    (Items only contains primary keys)
    Based on those 3 entites are 3 view objects. Here AudiovisualsView and ImagesView inherit form ItemsView.
    For Items/ItemsView exists a many-to-many Assoc/Link to an Entity/View called Categories/CategoriesView.
    The Assoc is based on an intersection table.
    This intersection contains besides the two foreign keys another column with some number from a lookup, say 1, 2 and 3.
    Q1: how can I retrieve all Categories for an Item having e.g. 2 as number in the intersection? (just like filtering the retrieved Categories to some special attribute in the intersection)
    Q2: where do I have to place the code for this filtering? At the entity level or view level or ItemViewRowImpl?
    I supposes the signature must be something like "RowIterator getCategoriesView(int intersectionAttr)"
    Q3: at the level of UIX, how can I pass the parameter to getCategoriesView?
    Thanks in advance for any help, Christian
    p.s. my data control palette only shows methods exposed at the view level but does not show methods at the view row level. How can I bind methods exposed in the client row interface to my uix page?

    any hints?
    thanks, Christian

  • Many to many join

    Hello,
    Please help me create the many-to-many relationship between these tables that I willl need to do a Master Detail form. The master is tblStandardSheets (PK: ID) the detail is tblSubject (PK: SUBJECTID) and the link is tblLink (PK: RECID, FK: ID, SUBJECTID).
    CREATE TABLE "tblStandardSheets"
    (     "ID" NUMBER NOT NULL ENABLE,
         "SHEET" VARCHAR2(100),
         "TITLE" VARCHAR2(255),
         CONSTRAINT "tblStandardSheets_PK" PRIMARY KEY ("ID") ENABLE
    CREATE OR REPLACE TRIGGER "BI_tblStandardSheets"
    before insert on "tblStandardSheets"
    for each row
    begin
    if :NEW."ID" is null then
    select "TBLSTANDARDSHEETS_SEQ".nextval into :NEW."ID" from dual;
    end if;
    end;
    ALTER TRIGGER "BI_tblStandardSheets" ENABLE
    CREATE TABLE "tblLink"
    (     "ID" NUMBER NOT NULL ENABLE,
         "RECID" NUMBER NOT NULL ENABLE,
         "SUBJECTID" NUMBER NOT NULL ENABLE,
         CONSTRAINT "tblLink_PK" PRIMARY KEY ("RECID") ENABLE
    ALTER TABLE "tblLink" ADD CONSTRAINT "TBLLINK_FK" FOREIGN KEY ("ID")
         REFERENCES "tblStandardSheets" ("ID") ON DELETE CASCADE ENABLE
    ALTER TABLE "tblLink" ADD CONSTRAINT "TBLLINK_FK2" FOREIGN KEY ("SUBJECTID")
         REFERENCES "tblSubject" ("SUBJECTID") ON DELETE CASCADE ENABLE
    CREATE OR REPLACE TRIGGER "BI_tblLink"
    before insert on "tblLink"
    for each row
    begin
    if :NEW."RECID" is null then
    select "TBLLINK_SEQ".nextval into :NEW."RECID" from dual;
    end if;
    end;
    ALTER TRIGGER "BI_tblLink" ENABLE
    CREATE TABLE "tblSubject"
    (     "SUBJECTID" NUMBER NOT NULL ENABLE,
         "SUBJECT" VARCHAR2(255),
         CONSTRAINT "tblSubject_PK" PRIMARY KEY ("SUBJECTID") ENABLE
    CREATE OR REPLACE TRIGGER "BI_tblSubject"
    before insert on "tblSubject"
    for each row
    begin
    if :NEW."SUBJECTID" is null then
    select "TBLSUBJECT_SEQ".nextval into :NEW."SUBJECTID" from dual;
    end if;
    end;
    ALTER TRIGGER "BI_tblSubject" ENABLE
    ALTER TABLE "tblSubject" ADD CONSTRAINT "tblSubject_FK" FOREIGN KEY ("SUBJECTID")
         REFERENCES "tblLink" ("SUBJECTID") ON DELETE CASCADE ENABLE
    ORA-02270: no matching unique or primary key for this column-list
    Edited by: user6753348 on Mar 31, 2009 1:39 PM

    Like this:
      CREATE TABLE "tblStandardSheets"
       (     "ID" NUMBER NOT NULL ENABLE,
         "SHEET" VARCHAR2(100 BYTE),
         "TITLE" VARCHAR2(255 BYTE),
          CONSTRAINT "tblStandardSheets_PK" PRIMARY KEY ("ID")
    CREATE OR REPLACE TRIGGER "BI_tblStandardSheets"
    before insert on "tblStandardSheets"
    for each row
    begin
    if :NEW."ID" is null then
    select "TBLSTANDARDSHEETS_SEQ".nextval into :NEW."ID" from dual;
    end if;
    end;
    ALTER TRIGGER "BI_tblStandardSheets" ENABLE
      CREATE TABLE "tblSubject"
       (     "SUBJECTID" NUMBER NOT NULL ENABLE,
         "SUBJECT" VARCHAR2(255 BYTE),
          CONSTRAINT "tblSubject_PK" PRIMARY KEY ("SUBJECTID")
    CREATE OR REPLACE TRIGGER "BI_tblSubject"
    before insert on "tblSubject"
    for each row
    begin
    if :NEW."SUBJECTID" is null then
    select "TBLSUBJECT_SEQ".nextval into :NEW."SUBJECTID" from dual;
    end if;
    end;
    ALTER TRIGGER "BI_tblSubject" ENABLE
      CREATE TABLE "HR"."tblLink"
       (     "ID" NUMBER NOT NULL ENABLE,
         "RECID" NUMBER NOT NULL ENABLE,
         "SUBJECTID" NUMBER NOT NULL ENABLE,
          CONSTRAINT "tblLink_PK" PRIMARY KEY ("RECID")
          CONSTRAINT "TBLLINK_FK" FOREIGN KEY ("ID")
           REFERENCES "tblStandardSheets" ("ID") ON DELETE CASCADE ENABLE,
          CONSTRAINT "TBLLINK_FK2" FOREIGN KEY ("SUBJECTID")
           REFERENCES "tblSubject" ("SUBJECTID") ON DELETE CASCADE ENABLE
    CREATE OR REPLACE TRIGGER "BI_tblLink"
    before insert on "tblLink"
    for each row
    begin
    if :NEW."RECID" is null then
    select "TBLLINK_SEQ".nextval into :NEW."RECID" from dual;
    end if;
    end;
    ALTER TRIGGER "BI_tblLink" ENABLE
    /You have to create the sequences yourself...
    HTH
    Roel

  • Many to Many View Link

    Hello All
    I just wish to know how to create a many to many view link. I have created a many to many association. In the view link wizard it is supposed to show me an association in 2 tables which are associated via the intersection table in the association right? Because that does not happen. I can only see the association in one table, while it is just not there in my source table. The expose check is clicked in both the source and the destination but in the destination table it is just not shown.
    I do not know if I am approaching this the right way? Should I create a view for the intersection table?
    If anyone can shed any light on this I would be eternally gratefull

    I solved the problem but now have a different one.
    The problem was I created some views and then created an association. Unfortunately associations are based on entities and views do no automatically update from the entities, so I had to create a new view, based on the entity AFTER I had created the association. This allowed me to create a many to many view link between the two.
    Here is a question. Is it really neccessary to create these many to many relations (which are in my database) if all I need is to create a read only page (for users with only read privileges)? Because after dropping my new view with a many to many view link onto my jspx page and creating a read only form, It did not really work that well for showing what I needed shown, all it did was show the attributes from the one table, not the 3 (the 2 tables and the intersection) I needed.
    I am probably not making sense, this is just a web of entangled entanglement.

  • Many "many-to-many-" questions ;)

    Hello everyone,
    1 - I am trying to use two many-to-many transactions on the same page. Everything seems to be working except that the supplemental fields are not inserting or updating into the database. No error is being returned.
    2 - Is there a way to validate the data that is being entered via these supplemental fields? I want to check that any item that is checked actually has a cost entered for it.
    Thanks for any help you can provide.
    A Read

    OK.. so I have figured out the problem with the first part of my question.<br /><br />It seems that there is a bug in the ADDT many-to-many wizzard when there are more than one of them in a form.<br /><br />The first transaction is referred to in all of the code as mtm_<whatever the fields are>, subsequent fields are referred to as mtm1_<whatever the fields are>, mtm2_<whatever the fields are>, etc.<br /><br />It seems that the wizzard does a good job of re-numbering all of these EXCEPT when it comes to the form's boxes name and id for any supplemental fields.  I had to re-number them from mtm_<blah blah> to mtm1_<blah blah> and now they work...<br /><br />Now onto the second part of my question.<br /><br />A Read

Maybe you are looking for