Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Apparently, an error (or another Oracle puzzle a-la Daniel)

Re: Apparently, an error (or another Oracle puzzle a-la Daniel)

From: Thomas Wagner <twapriv-nospam_at_yahoo.com>
Date: 26 Feb 2004 09:00:36 -0800
Message-ID: <3a07da7d.0402260900.fc0f62b@posting.google.com>


wizofoz2k_at_yahoo.com.au (Noons) wrote in message news:<73e20c6c.0402260223.71c5c301_at_posting.google.com>...
> 9ir2, SQL*Puss:
>
> Purr>desc zot
> Name Null? Type
> ----------------------------------------------------- --------
> -------------- F1
> NUMBER
> F2
> VARCHAR2(20)
> F3 DATE
>
> Purr>alter table zot modify (f1 not null);
> alter table zot modify (f1 not null)
> *
> ERROR at line 1:
> ORA-01442: column to be modified to NOT NULL is already NOT NULL
>
> Elapsed: 00:00:00.00
> Purr>desc zot
> Name Null? Type
> ----------------------------------------------------- --------
> -------------- F1
> NUMBER
> F2
> VARCHAR2(20)
> F3 DATE
>
>
> A virtual shot of single malt for the first correct solution.
> Hint: HJR discussed why, a while ago in a different context.
>
> Cheers
> Nuno Souto
> wizofoz2k_at_yahoo.com.au.nospam

Here we go:

SQL>create table x (
  2 n1 number constraint c1 not null,
  3 n2 number
  4 );

Table created.

SQL>desc x

 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 N1                                        NOT NULL NUMBER
 N2                                                 NUMBER

SQL>alter table x disable constraint c1;

Table altered.

SQL>desc x

 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 N1                                                 NUMBER
 N2                                                 NUMBER

SQL>alter table x modify (n1 not null);
alter table x modify (n1 not null)

                      *

ERROR at line 1:
ORA-01442: column to be modified to NOT NULL is already NOT NULL

SQL>@desc x

 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 N1                                                 NUMBER
 N2                                                 NUMBER

SQL>alter table x enable constraint c1;

Table altered.

SQL>desc x

 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 N1                                        NOT NULL NUMBER
 N2                                                 NUMBER

Best regards
Thomas Received on Thu Feb 26 2004 - 11:00:36 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US