Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2007
    Posts
    64

    Thumbs down Unanswered: CHECK in create table column

    Hi ,

    I tried executing the below query

    Create table temp1(i number(2) CHECK(i=0 or i=1) DEFAULT 1 NOT NULL)

    It throws an error, however if i remove 'DEFAULT 1' the query is getting executed . Please suggest me some good articles about the usage of CHECT directly in table column definitions .

    Thanks ,
    Sush

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Simply rearrange the statement:
    Code:
    SQL> CREATE TABLE temp1
      2    (i NUMBER(2) DEFAULT 1
      3                 NOT NULL
      4                 CHECK (i = 0 OR i = 1)
      5    );
    
    Table created.
    
    SQL>
    Read more about constraints here.

Posting Permissions

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