Solved

Update date field

Posted on 2012-04-10
4
657 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
  • 3
4 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
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 Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

730 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