Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Posts
    79

    Unanswered: Table column definition alter

    Hi,

    I have my tabe and data in it.
    Now i want to alter one column (make it non null)
    How???
    SQL Plus workseet says table must e non empty to alyter column defintion (to not null)
    Thanks in advance

  2. #2
    Join Date
    Feb 2004
    Posts
    108
    You want that column to be not null. Any idea what to do with rows having nulls in this column ? Deleting ? Or updating to some value? This needs to be fixed before you put the not null constraint.

  3. #3
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: Table column definition alter

    That's true, you must populate the column first - unless you only want the rule to apply to data added from now on, in which case:

    alter table t add constraint t_nn check (col is not null)
    enable novalidate;

  4. #4
    Join Date
    Jul 2003
    Posts
    2,296
    consider a default value with your not-null clause:
    PHP Code:
    platform@kod1alter table customer modify ACCT_STATUS_CD default 'X' not null;

    Table altered
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  5. #5
    Join Date
    Feb 2004
    Posts
    79

    Re: Table column definition alter

    Originally posted by andrewst
    That's true, you must populate the column first - unless you only want the rule to apply to data added from now on, in which case:

    alter table t add constraint t_nn check (col is not null)
    enable novalidate;

    Hi All,
    Thanks for the replies.I will try that

    enable novalidate;

    please elucidate the "novalidate" above.Thanks.

Posting Permissions

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