subquery not allowed here

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Allen

    subquery not allowed here

    Oracle 9.
    Trying to put a constraint. The date_time field in table Visit should
    be >= than date_admitted field in table Admission.

    CREATE TABLE Visit (
    adid INT REFERENCES myAdmission(adi d),
    date_time DATE CONSTRAINT date_time_limit s
    CHECK (date_time >= ALL
    (SELECT date_admitted
    FROM Admission, Visit
    WHERE Admission.adid = Visit.adid)),
    );

    I get subquery not allowed here. I don't have much experience, but as
    far as i can tell from my book this should work. But then again I just
    learned that oracle does not allow ASSERTION which is taught in this
    book; so is this the same problem? If yes could someone tell me how to
    get around this please.
Working...