如何使用 oracle sql 开发人员工具为表中的字段设置空值?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1409570/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to set a null value to a field in a table using oracle sql developer tool?
提问by Cshah
Oracle SQL Developer allows you to update field values directly to the table without needing to write a sql script. However it doesnt allow you to set a null value for a field? the update script that gets generated is below : UPDATE "TABLE" SET field_required = 'null' WHERE ROWID = 'AAAnnZAAFAAAGMfAAC' AND ORA_ROWSCN = '14465324'
Oracle SQL Developer 允许您直接将字段值更新到表中,而无需编写 sql 脚本。但是它不允许您为字段设置空值?生成的更新脚本如下: UPDATE "TABLE" SET field_required = 'null' WHERE ROWID = 'AAAnnZAAFAAAGMfAAC' AND ORA_ROWSCN = '14465324'
Any idea how to set a null value to a field in the table without writing an update statement ?
知道如何在不编写更新语句的情况下为表中的字段设置空值吗?
采纳答案by DCookie
What version are you using? I've got 1.5.4 right now and it works perfectly. Just click the value and hit delete, then commit.
你用的是什么版本?我现在有 1.5.4,它运行良好。只需单击该值并点击删除,然后提交。
回答by charlie
Using SQL Developer 3.0 here. What works for me is to first highlight the cell that I want to set to null. Hit backspace twice and move out of the cell (or do whatever you need to do to get out of edit mode). The first backspace puts the cell into edit mode and clears out the existing value. The second backspace is where the "null" value gets set (this is not visually apparent). Commit your changes and the null values will now show up in the refreshed data.
在这里使用 SQL Developer 3.0。对我有用的是首先突出显示我想设置为空的单元格。按两次退格键并移出单元格(或执行任何您需要执行的操作以退出编辑模式)。第一个退格键将单元格置于编辑模式并清除现有值。第二个退格是设置“空”值的地方(这在视觉上不明显)。提交您的更改,现在空值将显示在刷新的数据中。
回答by Rob van Laarhoven
Do you mean editing in the data tab? Just insert an 'empty' string, which in oracle is equal to null.
你的意思是在数据选项卡中编辑?只需插入一个“空”字符串,在 oracle 中它等于 null。
Set "Display null value as" to (null) in tools -> preferences -> Database -> advanced settings
在工具 -> 首选项 -> 数据库 -> 高级设置中将“将空值显示为”设置为(空)
create table ff (v VARCHAR2(1));
INSERT INTO FF VALUES ('1');
Select table and select data tab.
选择表并选择数据选项卡。
This shows
由此可见
V
=
1
Now double click the value 1 and delete the 1. Commit generates this statement in log:
现在双击值 1 并删除 1。 Commit 在日志中生成以下语句:
UPDATE "OSIVOLG"."FF" SET V = WHERE ROWID = 'AAA+zcAAFAAF9rgAAA' AND ORA_ROWSCN = '77536476584'
Which is syntacticly not a valid SQL statement but data tab now shows.
这在语法上不是有效的 SQL 语句,但现在显示数据选项卡。
V
======
(null)
回答by Magne Rasmussen
Some tools use <ctrl+0>
to enter a NULL value.
某些工具用于<ctrl+0>
输入 NULL 值。
回答by Vincent Malgrat
there is a setting in tools -> preferences -> Database -> advanced settings
that allows you to reset the default display of NULL columns. If you set it to blank that will probably solve your issue.
有一个设置tools -> preferences -> Database -> advanced settings
允许您重置 NULL 列的默认显示。如果您将其设置为空白,则可能会解决您的问题。
回答by Wadi Diaz-wong
Select the relevant columns with the mouse (pressing CTRL to keep the selection as you go), then pressing SHIFT + DEL. This worked for me
用鼠标选择相关列(按 CTRL 以保持选择),然后按 SHIFT + DEL。这对我有用