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: Jurij Modic <jurij.modic_at_mf.sigov.mail.si>
Date: 1998/01/13
Message-ID: <34bbeb7a.7521533@www.sigov.si>#1/1

On Mon, 12 Jan 1998 21:51:39 -0600, Richard_Popovich_at_Whittman-Hart.com wrote:

>CREATE TABLE foo( id NUMBER(4),
> description VARCHAR2(20) DEFAULT 'Unassigned');
>
>When I insert the following records:
>....[SNIP].....
>
>[3]
> INSERT INTO foo VALUES(003, );
>ERROR at line 1:
>ORA-00936: missing expression

Ignore all postings suggesting that you simply drop the comma in the third insert statement - that is pure nonsence (how on earth would Oracle know to which column to assign your value 003?). If you follow those advices the only thing that will change will be the ORA error number you will be getting!

If you don't speciffy the collumn list in your INSERT statement then the VALUES list must match the table structure both in number of values/columns and in their corresponding possitions. So for your purpose you *MUST* suply a column name in your INSERT.

BTW, it is a good practice to allways fully specify the column list in the INSERT statement.

>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


Jurij Modic                             Republic of Slovenia
jurij.modic_at_mf.sigov.mail.si		Ministry of Finance
============================================================
The above opinions are mine and do not represent any official standpoints of my employer Received on Tue Jan 13 1998 - 00:00:00 CST

Original text of this message

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