Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL in constraints
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
![]() |
![]() |