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: check statement and assertion

Re: check statement and assertion

From: Andy Hassall <andy_at_andyh.co.uk>
Date: Wed, 26 Nov 2003 23:32:05 +0000
Message-ID: <1vcasv0qt5bt7p1lep3st6m1fkb5sd6mlc@4ax.com>


On Wed, 26 Nov 2003 13:48:22 -0800, Daniel Morgan <damorgan_at_x.washington.edu> wrote:

>laststubborn wrote:
>
>> I am trying to write a constraint in Oracle 9 with SQL statement.
>> During the creation of the table I have written
>>
>> check(exist
>> (select line_no, count(*)
>> from sections
>> group by line_no
>> having count(*)<=4));
>>
>> but this is not working. Is there anyway to get it worked?
>
>What is the origin of this syntax? Where did you find this?
>
>I ask because I've never seen anything like it in Oracle and just looked
>all over tahiti.oracle.com and otn.oracle.com and can not find any
>syntax even remotely resembling this.

 You've never seen a check constraint? That's hard to believe.

 The above would make some sort of sense if the OP hadn't fully read the restrictions on check constraints, since EXISTS (taking into account the typo in the poster's message) is an expression returning TRUE or FALSE.

 It's certainly recognisable syntax, but it's prohibited by the no-subqueries restrictions.

http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/clauses3a.htm#1002166

--
Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Received on Wed Nov 26 2003 - 17:32:05 CST

Original text of this message

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