DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: add constraint problem

  1. #1
    Join Date
    Jul 2001
    Posts
    334

    add constraint problem

    Hi,
    I am trying to add constraint, and getting this error.

    SQL> alter table ap6.ap_invoices_all
    add constraint up_inv_num check(invoice_num = upper invoice_num));


    ERROR at line 2:
    ORA-02293: cannot enable (AP6.UP_INV_NUM) - check constraint violated

    Hintts- The table is already populated. Is this could be the reason?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2002
    Location
    Up s**t creek
    Posts
    1,525
    Does your data meet the constraint requirement? If not you will need to create the constraint with the DISABLE option

    Code:
    ALTER TABLE ap6.ap_invoices_all
    ADD CONSTRAINT 
      up_inv_num CHECK(invoice_num = UPPER(invoice_num)) DISABLE;
    HTH
    Jim
    Oracle Certified Professional
    "Build your reputation by helping other people build theirs."

    "Sarcasm may be the lowest form of wit but its still funny"

    Click HERE to vist my website!

  3. #3
    Join Date
    Jan 2003
    Location
    Hull, UK
    Posts
    220
    hey check ur code

    u have missed a (

    it should be upper(invoice_num)

    and not invoice_num=upper invoice_num));

    HTH

    SS

Posting Permissions

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


Click Here to Expand Forum to Full Width