Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Trouble inserting record into ORACLE TABLE having column with default values

Re: Trouble inserting record into ORACLE TABLE having column with default values

From: Steve Dodsworth <sdodsworth_at_mother.co.uk>
Date: 1998/01/13
Message-ID: <01bd2024$e96a2100$720110ac@css9105>#1/1

Rich,

To use default values, dont use the extra column at all e.g.

insert into foo (id) values (1);

will work, I think if you specify a value (including null) for description, then Oracle will store the value.

Cheers
Steve



Richard_Popovich_at_Whittman-Hart.com wrote in article <884662894.852754446_at_dejanews.com>...
> Trying to build an Oracle7.3.2.2 DB with tables that have table
> column's with DEFAULT VALUES.
>
> I have a table similar to the following example:
>
> CREATE TABLE foo( id NUMBER(4),
> description VARCHAR2(20) DEFAULT 'Unassigned');
>
> When I insert the following records:
>
> [1]
> INSERT INTO foo VALUES(001, NULL);
> 1 ROW CREATED.
>
> [2]
> INSERT INTO foo VALUES(002, ' ');
> 1 ROW CREATED.
>
> [3]
> INSERT INTO foo VALUES(003, );
> ERROR at line 1:
> ORA-00936: missing expression
>
> SQL> SELECT * FROM foo;
>
> ID NAME
> --------- --------------------
> 1
> 2
>
> I am not able to get the DEFAULT VALUE for FOO.NAME.
>
> Appreciate any/all input,
>
> Rich
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
>
Received on Tue Jan 13 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US