Re: creating snapshot
Date: Sun, 30 Dec 2007 21:53:54 -0800 (PST)
Message-ID: <e2f94901-1a85-4291-be6b-8500c8ac42c8@e23g2000prf.googlegroups.com>
On Dec 27, 11:50 pm, Frank van Bortel <frank.van.bor..._at_gmail.com>
wrote:
> amitabh.me..._at_gmail.com wrote:
> > Consider the table myTable:
> > first_name varchar2(25),
> > last_name varchar2(25),
> > regNum number,
> > status varchar(20) -> nullable with default
> > value as 'new'
>
> > Primary Key is first_name, last_name, status
>
> I'd say you're having serious problems knowing Oracle:
>
> 1 create table myTable (
> 2 first_name varchar2(25) not null,
> 3 last_name varchar2(25) not null,
> 4 regNum number,
> 5 status varchar(20) default 'New'
> 6* )
> SQL> /
>
> Table created.
> SQL> desc mytable
> Name Null? Type
> ------------------------- -------- ----------------
> FIRST_NAME NOT NULL VARCHAR2(25)
> LAST_NAME NOT NULL VARCHAR2(25)
> REGNUM NUMBER
> STATUS VARCHAR2(20)
>
> SQL> alter table mytable add constraint mytab_pk primary key
> (first_name, last_name, status);
>
> Table altered.
>
> SQL> desc mytable
> Name Null? Type
> ------------------------- -------- ----------------
> FIRST_NAME NOT NULL VARCHAR2(25)
> LAST_NAME NOT NULL VARCHAR2(25)
> REGNUM NUMBER
> STATUS NOT NULL VARCHAR2(20)
>
> Please note the null-ability of the STATUS column: it is
> NOT NULL! Oracle does NOT support NULLABLE columns in a
> PRIMARY KEY
>
> Ergo: no need for a decode!
> --
> Regards,
> Frank van Bortel
>
> Top-posting is one way to shut me up...
My requirement is: If status is 'new' then the snapshot should have null as the value else it should have whatever value is there. For that I was trying to use the decode. Can this be done? Received on Sun Dec 30 2007 - 23:53:54 CST