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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Make a field have Default Values? (Table Creation)

Re: Make a field have Default Values? (Table Creation)

From: Andrew Babb <andrewb_at_mail.com>
Date: Fri, 23 Apr 1999 08:39:57 +0800
Message-ID: <371FC15D.203A0345@mail.com>


Brian,

The syntax should be;

parts number(14,2) default := 0.

Oracle's number(14,2) only states that the maximum number of decimals places is 2, but Oracle won't store this information for an integer.

To feedback a 2 digit decimal, use a format mask such as

to_char(parts,'9999999.99');

Andrew

Brian Lavender wrote:

> I am trying to create a table that has a default value in the event the user
> does not enter a value. I tried this statement for creating the table, but it
> does not work:
>
> create table test (
> id number not null ,
> parts number(14,2) default = 0.00
> )
>
> How do I make it so parts gets a value of 0.00 if the user does not insert a
> value?
>
> brian
> --
> Brian E. Lavender
> US Army Corps of Engineers -- Programmer / Systems Analyst
> Sacramento, CA (916) 557-6623
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Thu Apr 22 1999 - 19:39:57 CDT

Original text of this message

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