View Single Post

   
  #6 (permalink)  
Old 04-08-2008, 11:13 AM
Andy Hassall
 
Posts: n/a
Default Re: Check constraint question

On Fri, 25 Aug 2006 01:24:52 +0200, Sybrand Bakker <postbus@sybrandb.demon.nl>
wrote:

>>not a silly question. The point of the post is that I wanted to know
>>if it's going to work before I even give it to the DBA in charge of
>>creating the database.

>
>Ahh, I see, so you want US to try it.


This remonstration is valid; the OP should try it first on his own database,
not ask other people to run what his own computer can run.

>The only thing I remember (from a while ago) is constructs like you
>posted do NOT work, and you are limited to using DECODE expressions
>returning *boolean* true or false.


The OP's expression does evauluate to Boolean true or false; it's a Boolean
expression. It WILL work.

A DECODE statement can NEVER return true or false, as there is no Boolean type
on the SQL level, only on the PL/SQL level. A DECODE will NOT work as the
subject of a check constraint - you'll just get "ORA-00920: invalid relational
operator"

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Reply With Quote