pl Sql 删除查询

Pl Sql delete query

我需要在 Oracle 数据库中删除,但我只需要删除 table 的特定字段,现在我正在使用以下脚本

delete TABLE where co_id in ('XXX')and SUBSTR(CS_PENDING_STATE,-1)='p';

问题是这个查询也删除了 CS_PENDING_STATE 字段的所有行,我只需要删除附加到 CS_PENDING_STATE 字段的满足 SUBSTR 的信息。

我怎么才能得到这个donde???

谢谢。

您需要一个更新语句来将特定列值设置为 blank/null。

如果是可空字段:

update TABLE Set CS_PENDING_STATE = null where co_id in ('XXX')and SUBSTR(CS_PENDING_STATE,-1)='p';

如果是不可空字段:

update TABLE Set CS_PENDING_STATE = '' where co_id in ('XXX')and SUBSTR(CS_PENDING_STATE,-1)='p';