× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am trying to do the following:
Create table GDWEB/FTPUSER
       ( 
...
       ID400 character (10),
...
        constraint FTPUSER_InvalidID400        check( 
         (ID400 is null) or 
         ( 
 
          (substr(ID400,4,1) between '0' and '9') and 
          (substr(ID400,5,1) between '0' and '9') and 
          (substr(ID400,6,1) between '0' and '9') and 
          (substr(ID400,7,1) between '0' and '9') and 
          (substr(ID400,8,1) between '0' and '9') and 
          (substr(ID400,9,1) between '0' and '9') and 
          (substr(ID400,10,1) between '0' and '9')) ), 
 
        constraint FTPUSER_DupID400 unique (ID400), 
        constraint FTPUSER_REFID400 foreign key (substr(ID400,1,3))
        references gdweb/ftpcompany (userprefix) 
) 

Now, in file FTPCOMPANY the field USERPREFIX is character(3).  In file 
FTPUSER the field ID400 is character(10).  I just want to make sure that 
the first three characters of ID400 were in the field USERPREFIX in the 
file FTPCOMPANY.

I was hoping to avoid a trigger.

I tried the above and get:  SQL0104-Token ( was not valid. Valid tokens: ) 
,.

I tried 
              constraint FTPUSER_InvalidID400        check( 
               (ID400 is null) or 
               ((substr(ID400,1,3) in (select USERPREFIX from
      GDWEB/FTPCOMPANY)) and 
                (substr(ID400,4,1) between '0' and '9') and 
                (substr(ID400,5,1) between '0' and '9') and 
                (substr(ID400,6,1) between '0' and '9') and 
                (substr(ID400,7,1) between '0' and '9') and 
                (substr(ID400,8,1) between '0' and '9') and 
                (substr(ID400,9,1) between '0' and '9') and 
                (substr(ID400,10,1) between '0' and '9')) ),
and got SQL0546-
Message . . . . :   CHECK condition of constraint *N not valid.  
Cause . . . . . :   The CHECK condition of constraint *N is not valid for 
one 
  of the following reasons:  
    -- a column level CHECK condition refers to some other column in the 
table
    -- the CHECK condition refers to a column that is not in this table  
    -- the CHECK condition refers to a special register  
    -- the CHECK condition uses a column function (such as AVG or COUNT) 
or a 
  user-defined function  
    -- the CHECK condition contains a subselect  
    -- the CHECK condition uses the NODENAME scalar function  
    -- the CHECK condition uses an expression involving LOBs.  

Rob Berendt
-- 
"They that can give up essential liberty to obtain a little temporary 
safety deserve neither liberty nor safety." 
Benjamin Franklin 

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.