How to insert NULL in to date field Oracle SQL Developer

Viewed 69735
CREATE TABLE pledge
(
    pledge_ID            NUMBER NOT NULL ,
    pledge_endDate       DATE NULL ,
    pledge_startDate     DATE NULL  ,
    pledge_amount        DECIMAL(9,2) NULL  CONSTRAINT  Currency_1322638346 CHECK (pledge_amount >= 0),
    artist_userID        NUMBER NOT NULL,
    follower_userID      NUMBER NOT NULL, 
CONSTRAINT  XPKPledge PRIMARY KEY (pledge_ID),
CONSTRAINT gets FOREIGN KEY (artist_userID) REFERENCES ArtistMember (user_ID),
CONSTRAINT makes FOREIGN KEY (follower_userID) REFERENCES FollowerMember (user_ID)
);

When I try to insert a null value I get the error below.

INSERT INTO pledge VALUES(559, 'null','1-FEB-2016', 3850, 85275, 88128);

Error report -
SQL Error: ORA-00904: : invalid identifier
00904. 00000 -  "%s: invalid identifier"
*Cause:    
*Action:
Error starting at line : 209 in command -
INSERT INTO pledge VALUES(559, 'NULL','1-FEB-2016', 3850, 85275, 88128)
Error at Command Line : 209 Column : 13
Error report -
SQL Error: ORA-00942: table or view does not exist
00942. 00000 -  "table or view does not exist"
*Cause:    
*Action:
2 Answers

Insert an empty string '' to a NUMBER column, Oracle will insert NULL.

For example, col_2 has data type is date field or number(12,0) (any datatype what not date field), SQL statement set NULL value for col_2 like this:

insert into foo (col_1, col_2) values ('abc', '');

or

insert into foo (col_1, col_2) values ('abc', NULL);

(it is NULL, not 'NULL' or "NULL")

Related