Results 1 to 4 of 4
  1. #1
    Join Date
    May 2004
    Posts
    12

    Unanswered: SQL, History Records (Oracle)

    Hi again I need to produce a script to input from the keyboard a month, and for all History records for that month, work out the number of nights each room was occupied and the occupancy rate for each room, for example 50% if room was occupied every other night. Also need to produce sub-totals for each category of room, and also for the hotel as a whole.

    Any Suggestions?

    Thx

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Sounds to me like you need to write a few SELECT statements ;-)

    Is there any particular bit you are struggling with?

  3. #3
    Join Date
    May 2004
    Posts
    12
    Hi there so far I came up with the code below

    start c:\SQL\month.sql
    set serveroutput on format wrapped
    set verify off
    set feedback off
    clear screen
    prompt
    accept booking_Date_of_Arrival format A15 prompt "Given Month: "
    select RoomNumber, Date_of_Arrival, , (DepartureDate- Date_of_Arrival) Time, (((DepartureDate - Date_of_Arrival)/31)*100) Rate, Number_of_Children, Number_of_Children
    from history
    where Arrival =to_date(&MonthName)
    set feedback on
    set verify on
    set serveroutput off

    And all its doing now is coming up with the number 7 any ideas?
    Thx guys.

  4. #4
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    You need to terminate the SQL statement:

    where Arrival =to_date(&MonthName);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •