Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1145
  • Last Modified:

how do I change a field to allow null values

I have a field that currently does not accept null values when inserting a record. I need to modify that field to accept null values. It is not the primary key in the table. What is the syntax for doing this?
0
sikyala
Asked:
sikyala
  • 4
  • 2
  • 2
  • +2
2 Solutions
 
mmeiselCommented:
Example:

ALTER TABLE
   customer
MODIFY
   (
   cust_name varchar2(100) not null,
   cust_hair_color  varchar2(20)
   )
;


http://www.dba-oracle.com/t_alter_table_modify_column_syntax_example.htm
0
 
sdstuberCommented:
alter table YOUR_TABLE modify YOUR_COLUMN null
0
 
awking00Commented:
sdstuber,
I think the syntax requires parentheses with that usage -
alter table YOUR_TABLE modify (YOUR_COLUMN null);
but I also think you can use -
alter table YOUR_TABLE modify COLUMN YOUR_COLUMN null;
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sdstuberCommented:
nope, works exactly as posted
0
 
sdstuberCommented:
I tested it before posting
ee.txt
0
 
awking00Commented:
Okay, I ran into that issue once before but I think it was for an earlier version. Sorry.
0
 
sdstuberCommented:
no problem,  I tested on 10g and 11g,  didn't go back any further because the posted zone was 10.x
0
 
sikyalaSenior Database AdministratorAuthor Commented:
Thanks sdstuber!
0
 
sventhanCommented:
What was the error message when you insert nulls?
0
 
sikyalaSenior Database AdministratorAuthor Commented:
It was someone else working on a development server. They just asked me if I could fix the problem. I found out recently that they made the field in question a primary key and it should not be a primary key. So I am trying to figure out the name of the primary key so that I can drop it and then change the column to accept null values.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now