Search code examples
sqloracle-databasesql-updatenullablenon-nullable

Delete Data from Non-Nullable Column in SQL


Question: I have table with three column, with column names APP_NAME, APP_TYPE and VALUE_TIME.

enter image description here

I would like to edit VALUE_TIME for particular APP_NAME and APP_TYPE. So my query should look like below mentioned if VALUE_TIME column is Nullable. So what would be the best way to delete the data for particular condition ?

UPDATE TABLE_NAME
SET VALUE_TIME = null
WHERE APP_NAME = 'XYZ'
AND APP_TYPE = 'TEST'; 

Thanks


Solution

  • Simple Answer, You can't update non-nullable column data to NULL or ' ' in oracle. I could only think of is Alter the column to have null.

    ALTER 
    TABLE TABLE_NAME 
    MODIFY VALUE_TYPE VARCHAR2(500) NULL