Subject | RE: [firebird-support] can i use UDFs with CHECK constraint (trigger) ? |
---|---|
Author | Thomas Steinmaurer |
Post date | 2004-03-17T20:18:17Z |
Hi,
Assumed you have strlen in your database declared, the
following should work.
CREATE DOMAIN CODENAME VARCHAR(50) CHECK ( strlen( Value ) > 5 )
If you don't want to use an UDF for that, then the
following might work as well:
CREATE DOMAIN CODENAME AS
VARCHAR(50)
CHECK (VALUE LIKE '______%')
;
HTH,
Thomas Steinmaurer
LogManager Serie - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database and MS SQL Server
Upscene Productions
http://www.upscene.com
> i m having many fields in many tables which are required to have someOmit the last right parenthesis. That is one too much. ;-)
> minimum length strings
>
> so i thought to define DOMAIN for such kind of field, like following
>
> CREATE DOMAIN CODENAME VARCHAR(50) CHECK ( strlen( Value ) > 5 ) );
>
> but it generates error,
>
> is there any way to use UDFs in CHECK constraints , so that i dont have to
> write same code in all triggers
Assumed you have strlen in your database declared, the
following should work.
CREATE DOMAIN CODENAME VARCHAR(50) CHECK ( strlen( Value ) > 5 )
If you don't want to use an UDF for that, then the
following might work as well:
CREATE DOMAIN CODENAME AS
VARCHAR(50)
CHECK (VALUE LIKE '______%')
;
HTH,
Thomas Steinmaurer
LogManager Serie - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database and MS SQL Server
Upscene Productions
http://www.upscene.com