Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: column with default char not defaulting when inserting a record
On Aug 3, 3:16 pm, Baldwin <ibaldwi..._at_gmail.com> wrote:
> Hi,
>
> I got this very interesting issue. I configured a column of a table
> defaulted to 'A'. Whenever I insert a record into the table without
> specifying a value in that column, the column is not defaulted to 'A'.
> I am able to default other char column without any problem. But for
> this one column, for some reason, it is not defaulting to 'A'. My
> table got 34 columns. There are foreign keys but not set to the column
> with the issue. I got a lot of triggers for this table, but i tried
> disabling them and inserted a record and still didn't work.
>
> Here is the example. the table and column names are not the actual
> names.
> -----------
> Here are my sql statements.
>
> insert into mytable(id, name)
> values(33, 'testme')
>
> select id, name, status
> from mytable
> where name = 'testme'
> -----------
> Here is the table definition.
>
> create table mytable
> (
> id NUMBER(10) not null,
> name VARCHAR2(60) not null,
> status CHAR(1) default 'A'
> )
> -----------
>
> Any help is greatly appreciated. thanks
> Baldwin
Gee, which release of Oracle are you using? In 10.2.0.2 it works without issue:
SQL> create table mytable
2 (
3 id NUMBER(10) not null,
4 name VARCHAR2(60) not null,
5 status CHAR(1) default 'A'
6 )
7 /
Table created.
SQL> insert into mytable(id, name)
2 values(33, 'testme')
3 /
1 row created.
SQL> select *
2 from mytable;
ID NAME S
When you can let us know which release of Oracle this is we can help you further.
David Fitzjarrell Received on Fri Aug 03 2007 - 15:22:44 CDT
![]() |
![]() |