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 6798749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:46:03+00:00 2026-05-26T18:46:03+00:00

so I am creating an oracle database for my university coursework on an airline.

  • 0

so I am creating an oracle database for my university coursework on an airline. Now i have a table called staff_allocations which allocate staff for flights in the Flight table.

CREATE TABLE FLIGHT (
  FLIGHT_ID NUMBER(11) PRIMARY KEY,
  ROUTE_ID NUMBER(11) NOT NULL,
  PLANE_ID NUMBER(11) NOT NULL,
  PILOT_ID NUMBER(11) NOT NULL,
  DEPARTURE_TIME TIMESTAMP NOT NULL,
  ARRIVAL_TIME TIMESTAMP NOT NULL,
  FREE_SEATS NUMBER (4)
);

CREATE TABLE STAFF_ALLOCATION (
    FLIGHT_ID NUMBER(11) NOT NULL,
    EMPLOYEE_ID NUMBER(11) NOT NULL
);

now the route_id in the flight table references the routes table.

CREATE TABLE ROUTE (
  ROUTE_ID NUMBER(11) PRIMARY KEY,
  START_ID VARCHAR2(3) NOT NULL,
  DESTINATION_ID VARCHAR2(3) NOT NULL,
  TRANSIT_ID VARCHAR2(3),
  IS_ACTIVE VARCHAR2(1),
  DISTANCE NUMBER (8,2),
  BASE_PRICE NUMBER (6,2)   
);

where start id, destination id and transit id all point to different airport codes (LHR, HAM, etc.)

so i am trying to make a trigger that will figure out before insert on staff_allocation, whether the staff is allocated to another flight whose time overlaps with the new one. also, it has to check whether the staff is actually in the same country as the origin of the flight.

so something like this :

find which flights staff member is allocated to already.
compare new flight departure time to existing flight departure times.
if flight times don’t clash, then see if staff is already in the country of the new start_id

can anyone help me out with either example code or by pointing me in the right direction in what i should be looking at/using? this is my first time at creating anything with oracle.

cheers.

  • 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-05-26T18:46:04+00:00Added an answer on May 26, 2026 at 6:46 pm

    The first check is quite easy. If you know the departure and landing of the flight you are modifying, you can check if there exists another flight for the employee, of which the arrival datetime is greater than the departure date of the current flight, and the departure datetime of that flight is before the arrival date time of the current flight.

    If such a flight exists, it overlaps with your current flight. But this is more logic that Oracle.

    The other check is harder (for a database). You will have to find the latest arrival for a specific employee and choose the country of arrival as the country in which the employee arrives.
    Note that this is hypothetical. Someone could have gone home as a passenger, or by bus. Also, you will need to make sure you have a starting point for each employee. So either you will have to allow everything for someone’s first flight, or you will have to register the country with the employee itself. The latter solution doesn’t ‘time travel’ very well, it is only a fixed location, and it doesn’t tell where the employee will be on a certain date. So I would just allow any allocation for employees that are new, and don’t bother about the rest for this assignment.

    The main problem you’re going to face, is that you cannot query a table in a row level trigger on that same table. So for this to work out, you will have to remember the inserted records and write a table level after insert trigger to do the checking.

    I’d love to give you some code, but people keep telling me that students should do their own. So I’ll leave the implementation to you, while I’m going to do my own homework. 🙂

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

Sidebar

Related Questions

I have an Oracle 9 database from which my Delphi 2006 application reads data
Oracle Newbie Here: I just started out creating my first Oracle database table. I
Can anybody provide the steps for creating DataSource in JBoss server(5.0) with Oracle Database..
I have thought of creating my first database application for one of my projects
I need some help in auditing in Oracle. We have a database with many
I have a schema in an Oracle 11g R2 database that I'm trying to
We have developed a Web Application using grails, groovy and oracle as database with
I have live audio that I would like to feed into a oracle database.
I don't know much about database administration. My problem is i have a oracle
I am used to using Oracle Designer by creating database object definitions, then creating

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.