Subject loop on ascci_char()
Author cwkuok
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 :

temp = 0;
while (temp < 65) do
begin
a_char = ascii_char(temp)
Execute procedure Pos a_char, new.Field_1 RETURNING_VALUES
location;
if (location <> 0) then
begin
exception CS_ERMG_INVALID_DATAVIEW_NAME;
end
end

but i have error on "-arithmetic exception, numeric overflow, or
string truncation -" when i insert any character to the field_1

anyway rather than i rewrite in form:
a_char = ascii_char(0)
Execute procedure Pos a_char, new.Field_1 RETURNING_VALUES
location;
if (location <> 0) then
begin
exception CS_ERMG_INVALID_DATAVIEW_NAME;
end

a_char = ascii_char(1)
Execute procedure Pos a_char, new.Field_1 RETURNING_VALUES
location;
if (location <> 0) then
begin
exception CS_ERMG_INVALID_DATAVIEW_NAME;
end
...............

TIA