Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> SQL Newbie :) Whats wrong with ths statement can anyone tell me?

SQL Newbie :) Whats wrong with ths statement can anyone tell me?

From: Paul <paul_at_yeahright.com>
Date: 2000/05/12
Message-ID: <pnXS4.21$yY3.1756@news11-gui.server.ntli.net>#1/1

SQL> CREATE OR REPLACE TRIGGER secure_booking   2 BEFORE INSERT OR UPDATE ON booking
  3 FOR EACH ROW
  4 DECLARE

  5       CURSOR C1 IS
  6            SELECT patient_no,room_no,resv_date,to_date
  7            FROM BOOKING;
  8            booking_record C1%ROWTYPE;
  9  BEGIN
 10       IF INSERT OR UPDATE THEN
 11            FOR booking_record IN C1 LOOP
 12                 IF  :new.resv_date >= booking_record.resv_date
 13                 AND :new.to_date <= booking_record.to_date
 14                 OR  :new.resv_date <= booking_record.resv_date
 15                 AND :new.to_date >= booking_record.to_date
 16                 OR  :new.resv_date <= booking_record.resv_date
 17                 AND :new.to_date <= booking_record.to_date
 18                 OR  :new.resv_date >= booking_record.resv_date
 19                 AND :new.to_date >= booking_record.to_date
 20                 THEN
 21                      RAISE_APPLICATION_ERROR (-20501,
 22                          'There is already a booking for this room at
this date');
 23                 END IF;
 24            END LOOP;
 25       END IF;

 26 END;
 27 /
CREATE OR REPLACE TRIGGER secure_booking *
ERROR at line 1:
OCA-30021: error preparing/executing SQL statement [POL-5228] syntax error Received on Fri May 12 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US