Advertisement
HenX

DAIS_1

Feb 28th, 2012
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 0.49 KB | None | 0 0
  1. ALTER TABLE "User" ADD (maxActiveReservationCount INT);
  2.  
  3. CREATE OR REPLACE
  4. FUNCTION getReservationCount (
  5.                   p_idUser "User".iduser%TYPE
  6.                   ) RETURN INT AS
  7.  
  8. reservationCounter INT;
  9. BEGIN
  10. SELECT COUNT(*) INTO reservationCounter FROM Reservation WHERE iduser = p_iduser;
  11. RETURN reservationCounter;
  12. END;
  13.  
  14. SET SERVEROUTPUT ON
  15. DECLARE
  16. output VARCHAR2(10);
  17. BEGIN
  18. output:= getReservationCount(5);
  19. DBMS_OUTPUT.PUT_LINE('NUMBER OF RESERVATIONS: '|| output);
  20. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement