Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9199333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:30:44+00:00 2026-06-17T22:30:44+00:00

I have four tables. PERSON DELIVERY_MAPPING GENERATION_SYSTEM DELIVERY_METHOD —— —————- —————– ————— ID PERSON_ID

  • 0

I have four tables.

PERSON     DELIVERY_MAPPING       GENERATION_SYSTEM       DELIVERY_METHOD
------     ----------------       -----------------       ---------------
ID         PERSON_ID              ID                      ID
NAME       GENERATION_SYSTEM_ID   NAME                    NAME
                                  DELIVERY_METHOD_ID      IS_SPECIAL

Example data:

PERSON     DELIVERY_MAPPING       GENERATION_SYSTEM       DELIVERY_METHOD
------     ----------------       -----------------       ---------------
1. TOM       1    1               1. COLOR PRINTER 1      1. EMAIL    N
2. DICK      1    2               2. BW PRINTER    1      2. POST     N
3. HARRY     2    3               3. HANDWRITTEN   3      3. PIGEONS  Y

A DELIVERY_METHOD contains ways to deliver new letters — EMAIL, POST, PIGEON. The IS_SPECIAL column marks a record as a means of a special delivery. It is indicated by a simple value of Y or N. Only PIGEON is a special delivery method i.e. Y, the others are not i.e. N.

The GENERATION_SYSTEM has the information that will finally print the letter. Example values are COLOR PRINTER and DOT MATRIX PRINTER. Each GENERATION_SYSTEM will always be delivered using one of the DELIVERY_METHODs. There’s a foreign key-between GENERATION_SYSTEM and DELIVERY_METHOD.

Now, each PERSON can have his letters generated by different GENERATION_SYSTEMs and since, it is a many-to-many relation, we have the DELIVERY_MAPPING table and that’s that’s why we have foreign key’s on both ends.

So far, so good.

I need to ensure that it if a person has his letters generated by a system that uses a special delivery method then he cannot be allowed to have multiple generation systems in the mappings list. For example, Dick can’t have his letters generated using the colour printer because he already gets all his handwritten letters delivery by a pigeon (which is a marked a special delivery method).

How would I accomplish such a constraint? I tried doing it with a before-insert-or-update trigger on the DELIVERY_MAPPING table but that causes the mutating trigger problem when updating.

Can is normalise this scenario even more? Maybe it is just that i haven’t normalised my table properly.

Either way, I’d love to hear your take on this issue. I hope I’ve been verbose enough (…and if you can propose a better title for this post, that would be great)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:30:46+00:00Added an answer on June 17, 2026 at 10:30 pm
     CREATE MATERIALIZED VIEW special_queues_mv
      NOLOGGING
      CACHE
      BUILD IMMEDIATE 
      REFRESH ON COMMIT 
      ENABLE QUERY REWRITE
         AS SELECT dmap.person_id
                 , SUM(DECODE(dmet.is_special, 'Y', 1, 0)) AS special_queues
                 , SUM(DECODE(dmet.is_special, 'N', 1, 0)) AS regular_queues
              FROM delivery_mapping dmap
                 , generation_system gsys
                 , delivery_method dmet
             WHERE dmap.generation_system_id = gsys.id
               AND gsys.delevery_method_id = dmet.id
             GROUP
                BY dmap.person_id
    /
    
      ALTER MATERIALIZED VIEW special_queues_mv
        ADD ( CONSTRAINT special_queues_mv_chk1 CHECK ((special_queues = 1 AND regular_queues = 0) OR ( regular_queues > 0 AND special_queues = 0 ) ) ENABLE VALIDATE)
    /
    

    That’s how I did it. DazzaL’s answer gave me a hint on how to do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have four tables in database. person(Perid ,firstname , lastname , gender) Research (Resid
I have four tables: characters arena_team arena_table_member arena_team_stats. characters table has guid, name arena_team
I have four tables: cuisines(id, name); recipes(id, cuisine_id, name, picture); ingredients(id, name); ingredients_recipes(ingredient_id, recipe_id);
I have four tables that contain some fields 1. user(id, name, email, password, .....)
I have four tables person,loan,ca,payments I would like to get the sum of all
Say i have Four tables 1) Studnets: Student_ID First Name Last Name 2) Contact
Say I have four tables: ------------- features -------------- id: int name: varchar ------------------------------------- --------
i have four tables user-question contains two columns: questionID, userID, the questions that the
I have four tables. Three of them are tables with one key and they
I have four tables: Users PrivilegeGroups rdPrivileges LinkPrivilege ----------- ---------------- --------------- --------------- userId(pk) privilegeGroupId(pk)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.