[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Update date field

Posted on 2012-04-10
4
Medium Priority
?
663 Views
Last Modified: 2012-04-20
I have a table in which I have the following fields

COLUMN_NAME      DATA_TYPE          NULLABLE      DATA_DEFAULT      
R_MODIFY_DATE      DATE                      No        (null)           
R_MODIFIER      VARCHAR2(32 BYTE)      No        (null)                  
R_LOCK_OWNER      VARCHAR2(32 BYTE)      No        (null)           
R_LOCK_DATE      DATE                      No        (null)           
R_LOCK_MACHINE      VARCHAR2(80 BYTE)      No        (null)           
R_OBJECT_ID      VARCHAR2(16 BYTE)      No            

I need to update a particular to have all blank or null values. I am executing the below query

update dm_sysobject_s
set r_lock_owner=' ',
r_lock_date=null,
r_lock_machine=' '
where r_object_id='3d00c0ba81cbd5c6'

It gives me an error message
ORA-01407: cannot update ("EDMSDEV"."DM_SYSOBJECT_S"."R_LOCK_DATE") to NULL

Can someone please let me know how to set the R_LOCK_DATE to blank or null.
0
Comment
Question by:ank5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 2000 total points
ID: 37828677
Three must be a not-null constriant on the column.

The only way to update it to null is remove the constraint.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37828704
You can find it with:

select constraint_name
from user_cons_columns
where table_name='DM_SYSOBJECT_S' and column_name='R_LOCK_DATE'

Once you get the name of the constraint, you can query USER_CONSTRAINTS for the CONSTRAINT_TYPE.
0
 
LVL 20

Expert Comment

by:flow01
ID: 37828759
or just alter the column definition (= removing the contraint)
ALTER TABLE DM_SYSOBJECT_S MODIFY R_LOCK_DATE      DATE    NULL
/

the not null constraint was placed with your table definition (as is referred to by NULLABLE NO in your table display )
CREATE TABLE ..
   (..
     R_LOCK_DATE      DATE    NOT NULL
   ..
   )
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37828771
>>or just alter the column definition (= removing the contraint)

I would not suggest doing this 'just because'.  A constraint in placed on a table for a reason.  If you remove it you can cause serious application issues.
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to recover a database from a user managed backup

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question