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: What's wrong with this picture?

Re: What's wrong with this picture?

From: Sybrand Bakker <postmaster_at_sybrandb.demon.nl>
Date: Tue, 28 Dec 1999 23:26:18 +0100
Message-ID: <946420050.24340.0.pluto.d4ee154e@news.demon.nl>


AFAIK you can't use functions in check constraints. As you probably already found out, you also can't sysdate directly. You need to address this by writing a trigger.

Hth,

--
Sybrand Bakker, Oracle DBA
mark m <mockm_at_my-deja.com> wrote in message news:84b9h2$hcu$1_at_nnrp1.deja.com...
> I have a function...
>
> create or replace function current_date
> return date as
>
> the_date date;
>
> begin
>
> select sysdate
> into the_date
> from sys.dual;
>
> return (the_date);
>
> end;
>
> ...which when used in this constraint...
>
> alter table fac_contracts
> add(constraint fcon_current_ck
> check (start_date < current_date and (end_date > current_date or
> end_date is null)));
>
> ...produces this error...
>
> SQLWKS> alter table fac_contracts
> 2> add(constraint fcon_current_ck
> 3> check (start_date < current_date and (end_date >
> current_date or end_date is null)));
> check (start_date < current_date and (end_date > current_date or
> end_date is null)))
> *
> ORA-00904: invalid column name
>
> What am I missing?
>
>
> --
>
> mark m @ team health
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Tue Dec 28 1999 - 16:26:18 CST

Original text of this message

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