Solved

Update date field

Posted on 2012-04-10
4
645 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 76

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 76

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 76

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now