• 0

[Oracle] Constraint specification not allowed here.


Question

I'm trying to add some data validation / integrity checks to an oracle database, I always get the error message "Constraint specification not allowed here"

Example:

create table student (

sex char(1) not null

constraint checksex ( sex in ('m', 'M', 'f', 'F', ));

This will give me - "ERROR at line 3: ORA-02253: constraint specification not allowed here"

I realise this is probably a basic question but im not having much luck finding out where I?m going wrong, if someone could point me in the right direction that would be great, Thank:):)

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Try this:

create table student (

sex char(1) not null

constraint checksex check ( sex in ('m', 'M', 'f', 'F'));

Link to comment
Share on other sites

  • 0

Thanks, that works perfectly!

You wouldn?t believe me if I told you how long I spent trying to work that out.

Much appreciated.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.