SHARE
TWEET

Untitled

a guest Oct 12th, 2019 112 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE OR REPLACE PROCEDURE cancelTicket2(bkingid IN NUMBER)
  2.     IS
  3.    
  4. cnt NUMBER;
  5. loc booking.location%TYPE;
  6. permission_denied EXCEPTION;
  7.  
  8. BEGIN
  9.     SELECT location INTO loc FROM booking WHERE bid = bkingid;
  10.     IF loc = 'Sylhet'
  11.             THEN
  12.                 UPDATE booking SET booking_status = 'Canceled' WHERE bid = bkingid;
  13.         COMMIT;    
  14.        
  15.         SELECT count_ INTO cnt FROM ticket
  16.             WHERE ticketid =
  17.                 (SELECT ticketid FROM booking WHERE bid = bkingid);
  18.                
  19.         IF cnt = 1
  20.             THEN
  21.                 UPDATE ticket SET status_ = 'available' WHERE
  22.                     ticketid =
  23.                     (SELECT ticketid FROM booking WHERE bid = bkingid);
  24.         END IF;
  25.         COMMIT;
  26.         RETURN 'Canceled';
  27.     ELSIF loc = 'Dhaka'
  28.             THEN RAISE permission_denied ;
  29.     END IF;
  30. EXCEPTION
  31.     WHEN permission_denied THEN DBMS_OUTPUT.put_line("You don't have the permission");
  32. END;
  33. /
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