Pular para o conteúdo

Fóruns Banco de dados Oracle Como colocar ‘NOT NULL’ em uma coluna sem fazer o check? Como colocar ‘NOT NULL’ em uma coluna sem fazer o check?

#89367
eversonpiza
Participante

    Gostei bastante da idéia do novalidate, mas fiz um teste aqui e pareceu algo estranho, quando dou um DESC na tabela ele não diz que o campo é NOT NULL, porem quando tento inserir novos dados null dá erro.

    SQL> create table teste_erp (x number);

    Table created.

    SQL> desc teste_erp;
    Name Null? Type


    X NUMBER

    SQL> alter table teste_erp modify x not null novalidate;

    Table altered.

    SQL> desc teste_erp;
    Name Null? Type


    X NUMBER

    SQL> alter table teste_erp modify x null;

    Table altered.

    SQL> desc teste_erp;
    Name Null? Type


    X NUMBER

    SQL> alter table teste_erp modify x not null ;

    Table altered.

    SQL> desc teste_erp;
    Name Null? Type


    X NOT NULL NUMBER