Subject Re: [ib-support] loop on ascci_char()
Author Helen Borrie
At 10:23 AM 10/04/2003 +0000, you wrote:
>the following trigger throw exception when insert 'A' into field_1
>for table_1:
>
>set term !! ;
>create trigger CS_table_1 for table_1
> before insert position 20
>as
> declare variable temp integer;
> declare variable a_char char;
> declare variable location integer;
>begin
> a_char = ascii_char(65)
> Execute procedure Pos a_char, new.Field_1 RETURNING_VALUES location;
> if (location <> 0) then
> begin
> exception CS_ERMG_INVALID_DATAVIEW_NAME;
> end
> end
>end!!
>set term ; !!
>
>but this is not what i want, i want to throw the exception when other
>insert character other than [A-Z] into field_1..
>
>so i need some of the part have a loop such as below :

Why do you need a procedure and a loop?

Won't this test do what you want?

if (ascii_val(new.Field_1) NOT BETWEEN 65 AND 90) then
exception CS_ERMG_INVALID_DATAVIEW_NAME;

heLen