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: SQL in constraints

Re: SQL in constraints

From: Feng Xiong <fengx_at_wolfram.com>
Date: Mon, 01 Mar 1999 12:59:42 -0600
Message-ID: <36DAE39E.CFFE333E@wolfram.com>

mgumbs_at_hotmail.com wrote:

> Is it possible to use SQL in constraints?
>
> e.g Create table football.....
> ...
> ...
> Constraint rs_football_name
> check name in (select name from register where....)

No, you cannot use check on queries that retrieves data, or on another table such as register.

>
> If not, are there any alternatives? I have thoought of a pre-insert trigger
> but is there anything else?

You could write out all the values such as:

    check name in ('name1', 'name2', 'name3'...)

Or, try to create a foreign key on rs_football_name that refers back to register.name.

Feng

>
> Replies by e-mail if poss.
>
> Mark
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Mon Mar 01 1999 - 12:59:42 CST

Original text of this message

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