Toad World® Forums

How do I insert a null value into a table?


#1

I have the following table defined:

CREATE TABLE testtable
(
id NUMERIC (20, 0) NOT NULL,
“name” CHARACTER VARYING (100) NOT NULL
)

In Toad Edge 2.0.2 when I use the “Data” tab of the table viewer and I insert a new record, I cannot figure out a way to insert a null value into the “name” column!

I click the plus icon to add a new row to the table. Then I double click on the “name” column, enter some string like “test 123”, and press Enter. Then I double click on the “name” column again and try to set it to a null value, but when I erase the contents of the field and press Enter, the value saved to the field is a blank string, not a null value.

How do I use the table viewer to enter a null value into a field? in Toad for Oracle, when I erase the contents of a column in a record using the table viewer, the value is set to null.


#2

Hello,
you can’t set NULL value for any cell in your table:
CREATE TABLE testtable
(
id NUMERIC (20, 0) NOT NULL,
“name” CHARACTER VARYING (100) NOT NULL
)
because this table have set constraints NOT NULL for booth columns.

If you want to remove the Not Null constraint then:

  1. Open Columns tab
  2. Select the column to which you want to remove Not Null constraint
  3. Open the Pop-Up menu (by mouse righ button) and select Drop “Not Null” constraint…
    image

If you have a table with columns without NOT NULL constraint, then you can set NULL by two ways:

  1. Select cell with value were you can set NULL, but don’t open data edit and open Pop-Up menu (by right mouse button) and selecet Set Null.
  2. Select cell with value were you can set NULL, but don’t open data edit and press Delete key.

Libor


#3

Thanks for showing me how to set Null values in Toad Edge.

Please forgive me for constantly comparing Toad Edge to Toad for Oracle, but our dev team is in a big Oracle to EDB Postgres migration project, so I’m using both tools extensively, and I keep hoping Toad Edge will behave like Toad for Oracle… they’re both Quest products, right? Toad for Oracle behaves the way I described in my last post… even if the column does not accept NULL values, when I clear the value, Toad for Oracle will attempt to set a NULL value for that column and when the record is saved, it will give an error indicating that the column doesn’t accept NULL values.