• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can we add null constraint to existing table

 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we add null constraint to existing table?
 
Shinil Mohan
Ranch Hand
Posts: 37
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes we can add null constraint to existing table.

ALTER TABLE `hibernate`.`billingdetails` CHANGE COLUMN `BANK_NAME` `BANK_NAME` VARCHAR(255) NOT NULL ;

ALTER TABLE `hibernate`.`billingdetails` CHANGE COLUMN `BANK_ACCOUNT_NO` `BANK_ACCOUNT_NO` VARCHAR(255) NULL ;
 
Matthew Brown
Bartender
Posts: 4567
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As long as the data already in the table satisfies the constraint. If it doesn't you'll have to fix the data first.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic