0

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

4

2 回答 2

2

如果要删除该行:

DELETE TABLE_NAME WHERE APP_NAME = 'XYZ' AND APP_TYPE = 'TEST'; 

VALUE_TYPE 列定义为 NOT NULL,因此您不能将其设置为 null。您可以更改表以使其可为空:

ALTER TABLE TABLE_NAME MODIFY VALUE_TYPE VARCHAR2(500) NULL;

然后在您的问题中运行 UPDATE 语句。

希望这能回答您的问题 - 目前尚不清楚您到底想做什么。

于 2013-09-11T21:35:59.653 回答
1

简单的答案,您不能在 oracle 中将不可为空的列数据更新为 NULL 或“”。我只能想到将列更改为空。

ALTER 
TABLE TABLE_NAME 
MODIFY VALUE_TYPE VARCHAR2(500) NULL
于 2013-09-11T22:04:28.770 回答