Click to See Complete Forum and Search --> : insert statement


bvg
04-30-2003, 10:40 AM
Hi
I was wondering when I write an insert statement how do I leave a date field blank( Not Null Date) and also the number field (NOT NULL NUMBER) blank.
thanks,
bvg

slimdave
04-30-2003, 11:03 AM
try one of these ...

SQL> create table my_table (col1 char(1),col2 number,col3 date);

Table created.

SQL> insert into my_table (col1) values ('A');

1 row created.

SQL> insert into my_table (col1,col2,col3) values ('A',null,null);

1 row created.

SQL> insert into my_table (col1,col2,col3) values ('A',to_number(null),
2 to_date(null));

1 row created.

SQL> select * from my_table;

C COL2 COL3
- ---------- ---------
A
A
A

SQL>

DaPi
04-30-2003, 11:09 AM
bvg, are the columns defined as NOT NULL? If so, you can't leave them blank . . .

bvg
04-30-2003, 11:18 AM
thank you so much DAV and DAPI for the info.