Run an assertion using SQL and PL/SQL
715920Aug 26 2009 — edited Sep 11 2009Hi,
suppose a schema has two tables, one is called Airplane and the other is called Airplane_Type. A row of Airplane described an airplane that is identified by airplane_id and it contains number of booked seat num_seat. A row of Airplane_Type table describes an airplane type with a maximum seat number max_seat. Airplane has foreign key air_type that is referencing an attribute in Airplane_Type table with the same name.
num_seat cannot be larger than max_seat, and this has to be done dynamically.
Questions:
1. How can I make an assertion is SQL so that when num_seat is larger than max_seat, an assertion is executed so that the num_seat cannot be increased because it reaches max_seat.
2. What is the best way to do it in PL/SQL.
3. If I want to optimize between scalability and performance, what is the best way to implement it if I want to use SQL and PL/SQL?
Regards,
Valerie