Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Mar 14th, 2018 58 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. SET SERVEROUTPUT ON
  2.  
  3. CREATE OR REPLACE PROCEDURE
  4. UEK4BSP1(P_FLIGHTID NUMBER) IS
  5.  
  6. INVALIDFLIGHTID EXCEPTION;
  7. V_VALIDFLIGHT NUMBER;
  8. V_TAKENSEATS NUMBER;
  9. V_CAPACITY NUMBER;
  10. V_AIRLINEID NUMBER;
  11. V_CITY_DEPARTURE VARCHAR2;
  12. V_CITY_ARRIVAL VARCHAR2;
  13.  
  14.  
  15.  
  16. BEGIN
  17.     SELECT COUNT(*) INTO V_VALIDFLIGHT FROM FLUG F
  18.     WHERE F.FLUGID = P_FLIGHTID;
  19.         IF(V_VALIDFLIGHT != 1)  THEN
  20.             RAISE INVALIDFLIGHTID;
  21.         END IF;
  22.        
  23.     -- Berechnet die belegten Plätze des ausgewählten Fluges
  24.     SELECT COUNT(SITZPLATZNUMMER) INTO V_TAKENSEATS FROM PASSAGIERLISTE
  25.     WHERE FLUGID = P_FLIGHTID;
  26.  
  27.     -- Berechnet die Gesamtkapazität des ausgewählten Flugzeugs
  28.     SELECT FLT.SITZPLAETZE INTO V_CAPACITY FROM FLUG F, FLUGZEUG FG, FLUGZEUGTYP FLT
  29.     WHERE F.FLUGID = P_FLIGHTID
  30.     AND F.FLUGZEUGID = FG.FLUGZEUGID
  31.     AND FLT.FLUGZEUGTYPID = FG.FLUGZEUGTYPID;
  32.        
  33.     -- Ausgabe
  34.     DBMS_OUTPUT.ENABLE;
  35.     DBMS_OUTPUT.PUT_LINE('Flugnummer        ' || P_FLIGHTID);  
  36.     DBMS_OUTPUT.PUT_LINE('Gesamtkapazitaet  ' || V_CAPACITY);
  37.     DBMS_OUTPUT.PUT_LINE('Besetzte Plaetze  ' || V_TAKENSEATS);
  38.    
  39.     -- Ausnahmen
  40.     EXCEPTION
  41.     WHEN INVALIDFLIGHTID THEN
  42.         DBMS_OUTPUT.PUT_LINE('Eingegebenen Flug nicht gefunden');
  43.     WHEN OTHERS THEN
  44.         DBMS_OUTPUT.PUT_LINE('Unbekannter Fehler aufgetreten');
  45. END;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top