SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict coolbuzz's Avatar
    Join Date
    Aug 2001
    Location
    Here
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Modifying Constraint?

    I have created a table using Oracle 8 (on win98se) as follows :
    create table sales_order
    (sales_order_no varchar(6) primary key,
    constraint sorderno check(sales_order_no like('O%')),
    s_order_date date,
    dely_type char(1) default 'F',
    constraint deltype check(dely_type in('P','F')),
    constraint delydate check(dely_date>s_order_date),
    order_status varchar(10),
    constraint orderstat check(order_status in('inprocess','fullfilled','backorder')))
    ;

    Now I want to modify the last constraint to include one more option for 'cancelled' along with the options present i.e inprocess,fullfilled, backorder .I want to know the command line editing for it.
    Please help.

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't modify a check constraint. Try dropping and adding it again.
    Code:
    ALTER TABLE sales_order
      DROP CONSTRAINT orderstat
    
    ALTER TABLE sales_order
      ADD CONSTRAINT orderstat CHECK(order_status IN('inprocess','fullfilled','backorder','cancelled'))

  3. #3
    SitePoint Addict coolbuzz's Avatar
    Join Date
    Aug 2001
    Location
    Here
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks redemption
    Got the problem solved.


Bookmarks

Posting Permissions

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