Update date field

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

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_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.
Question by:ank5
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
LVL 77

Accepted Solution

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.
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.
LVL 20

Expert Comment

ID: 37828759
or just alter the column definition (= removing the contraint)

the not null constraint was placed with your table definition (as is referred to by NULLABLE NO in your table display )
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.

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Suggested Courses

764 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