Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

not null column populated with a null

3778616Sep 14 2018 — edited Sep 14 2018

We have a table with column name 'Name' that has been set to NOT NULL.

However, when we recently had an issue due to NULL values in this table.

We have checked the script that populates the table and test various scenarios by trying to insert a null value manually and this fails ( as would be expected)

  1. Check table does not accept null values:

DESC LRF_PRT_REQUESTOR

Name Null Type

----------------- -------- -----------------

PRT_REQSTR_ID NOT NULL NUMBER(9)        

FACILITY_ID NOT NULL NUMBER(9)        

NAME NOT NULL VARCHAR2(20 CHAR)

PRT_REQSTR_DESC   NOT NULL VARCHAR2(40 CHAR)

PRIORITY NOT NULL NUMBER(9)        

CREATED_DTTM NOT NULL TIMESTAMP(6)     

LAST_UPDATED_DTTM TIMESTAMP(6)     

  1.   Try to insert a null  quoted value

Error starting at line : 5 in command -

INSERT INTO LRF_PRT_REQUESTOR

SELECT  LRF_PRT_REQSTR_ID_SEQ.NEXTVAL, -- PRT_REQSTR_ID

1, -- FACILITY_ID

'', -- NAME

'', -- PRT_REQST_DESC

1, -- PRIORITY

SYSDATE, SYSDATE

    FROM DUAL

Error report -

SQL Error: ORA-01400: cannot insert NULL into ("WM14DEV1A"."LRF_PRT_REQUESTOR"."NAME")

  1. 00000 - "cannot insert NULL into (%s)"

*Cause:   

*Action:

  1. Try to insert specific null into table .

Error starting at line : 5 in command -

INSERT INTO LRF_PRT_REQUESTOR

SELECT  LRF_PRT_REQSTR_ID_SEQ.NEXTVAL, -- PRT_REQSTR_ID

1, -- FACILITY_ID

null, -- NAME

null, -- PRT_REQST_DESC

1, -- PRIORITY

SYSDATE, SYSDATE

    FROM DUAL

Error report -

SQL Error: ORA-01400: cannot insert NULL into ("WM14DEV1A"."LRF_PRT_REQUESTOR"."NAME")

  1. 00000 - "cannot insert NULL into (%s)"

*Cause:   

*Action:

  1. Insert V_name variable with null values  ( as per script).

Error starting at line : 16 in command -

declare

v_name varchar2(10);

begin

INSERT INTO LRF_PRT_REQUESTOR

SELECT  LRF_PRT_REQSTR_ID_SEQ.NEXTVAL, -- PRT_REQSTR_ID

1, -- FACILITY_ID

v_name, -- NAME

v_name, -- PRT_REQST_DESC

1, -- PRIORITY

SYSDATE, SYSDATE

    FROM DUAL;  

end;

Error report -

ORA-01400: cannot insert NULL into ("WM14DEV1A"."LRF_PRT_REQUESTOR"."NAME")

ORA-06512: at line 5

  1. 00000 -  "cannot insert NULL into (%s)"

*Cause:   

*Action:

The only anomaly we see if when we write a select statement in SQL Developer the word 'name' is highlighted in blue to suggest that it is a reserved word.

Is name a reserved word in sql developer and if so, is it referring to a function that exists possibly?

We are struggling to determine how NULL values are being inserted.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 12 2018
Added on Sep 14 2018
3 comments
1,553 views