Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. create procedure Insert_Airplane(airplaneName in char, noOfSeat in int, airportID in int)
  2. is
  3. idAirplane int;
  4. begin
  5. select max(id) into idAirplane from (
  6. (select id from AIRPLANE1@DATABASE_DUNG)
  7. union all
  8. (select id from AIRPLANE2@DATABASE_VU)
  9. union all
  10. (select id from AIRPLANE3)
  11. union all
  12. (select id from AIRPLANE4@DATABASE_LONG)
  13. );
  14. idAirplane := idAirplane + 1;
  15.  
  16. if (idAirplane < 5) then --Dung
  17. insert into AIRPLANE1@DATABASE_DUNG values (idAirplane, airplaneName, noOfSeat, airportID);
  18. elsif (idAirplane >= 5 and idAirplane < 0 ) then --Vu
  19. insert into AIRPLANE2@DATABASE_VU values (idAirplane, airplaneName, noOfSeat, airportID);
  20. elsif (idAirplane >= 10 and idAirplane < 15) then --Trung
  21. insert into AIRPORT3 values (idAirplane, airplaneName, noOfSeat, airportID);
  22. elsif (idAirplane >= 15 and idAirplane < 20) then --Long
  23. insert into AIRPORT4@DATABASE_LONG values (idAirplane, airplaneName, noOfSeat, airportID);
  24. else
  25. dbms_output.put_line('Error');
  26. end if;
  27. end;
  28. exec Insert_Airplane('Boeing696', 500, 4);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement