Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create procedure Insert_Airplane(airplaneName in char, noOfSeat in int, airportID in int)
- is
- idAirplane int;
- begin
- select max(id) into idAirplane from (
- (select id from AIRPLANE1@DATABASE_DUNG)
- union all
- (select id from AIRPLANE2@DATABASE_VU)
- union all
- (select id from AIRPLANE3)
- union all
- (select id from AIRPLANE4@DATABASE_LONG)
- );
- idAirplane := idAirplane + 1;
- if (idAirplane < 5) then --Dung
- insert into AIRPLANE1@DATABASE_DUNG values (idAirplane, airplaneName, noOfSeat, airportID);
- elsif (idAirplane >= 5 and idAirplane < 0 ) then --Vu
- insert into AIRPLANE2@DATABASE_VU values (idAirplane, airplaneName, noOfSeat, airportID);
- elsif (idAirplane >= 10 and idAirplane < 15) then --Trung
- insert into AIRPORT3 values (idAirplane, airplaneName, noOfSeat, airportID);
- elsif (idAirplane >= 15 and idAirplane < 20) then --Long
- insert into AIRPORT4@DATABASE_LONG values (idAirplane, airplaneName, noOfSeat, airportID);
- else
- dbms_output.put_line('Error');
- end if;
- end;
- exec Insert_Airplane('Boeing696', 500, 4);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement