Subject ALTER/UPDATE a UDF reference
Author GNiessen
I am working on a FB1.5 server
I am trying to change a UDF reference for an existing function
that has many dependencies. Currently it is declared as

DECLARE EXTERNAL FUNCTION TRIMTODEL
CSTRING(10000) CHARACTER SET ASCII,
CSTRING(10000) CHARACTER SET ASCII
RETURNS CSTRING(10000) CHARACTER SET ASCII
ENTRY_POINT 'TrimToDel' MODULE_NAME 'UDF';

And I want to change it to:

DECLARE EXTERNAL FUNCTION TRIMTODEL
CSTRING(16000) CHARACTER SET ASCII,
CSTRING(16000) CHARACTER SET ASCII
RETURNS CSTRING(16000) CHARACTER SET ASCII
ENTRY_POINT 'TrimToDel' MODULE_NAME 'UDF';

How can I do this without having to redo every procedure that references it?

I tried:
UPDATE RDB$FUNCTIONS SET
RDB$MODULE_NAME='UDF',
RDB$RETURN_ARGUMENT=0,
RDB$ENTRYPOINT='TrimToDel'
WHERE RDB$FUNCTION_NAME='TRIMTODEL';

DELETE FROM RDB$FUNCTION_ARGUMENTS f
WHERE f.RDB$FUNCTION_NAME='TRIMTODEL';

INSERT INTO RDB$FUNCTION_ARGUMENTS(
RDB$FUNCTION_NAME, RDB$ARGUMENT_POSITION, RDB$MECHANISM, RDB$FIELD_TYPE, RDB$FIELD_SCALE,
RDB$FIELD_LENGTH, RDB$FIELD_SUB_TYPE, RDB$CHARACTER_SET_ID, RDB$FIELD_PRECISION, RDB$CHARACTER_LENGTH
) VALUES(
'TRIMTODEL',0,1,40,0,16000,0,2,0,16000);

INSERT INTO RDB$FUNCTION_ARGUMENTS(
RDB$FUNCTION_NAME, RDB$ARGUMENT_POSITION, RDB$MECHANISM, RDB$FIELD_TYPE, RDB$FIELD_SCALE,
RDB$FIELD_LENGTH, RDB$FIELD_SUB_TYPE, RDB$CHARACTER_SET_ID, RDB$FIELD_PRECISION, RDB$CHARACTER_LENGTH
) VALUES(
'TRIMTODEL',1,1,40,0,0,-1,2,0,16000);

INSERT INTO RDB$FUNCTION_ARGUMENTS(
RDB$FUNCTION_NAME, RDB$ARGUMENT_POSITION, RDB$MECHANISM, RDB$FIELD_TYPE, RDB$FIELD_SCALE,
RDB$FIELD_LENGTH, RDB$FIELD_SUB_TYPE, RDB$CHARACTER_SET_ID, RDB$FIELD_PRECISION, RDB$CHARACTER_LENGTH
) VALUES(
'TRIMTODEL',2,1,40,0,0,-1,2,0,16000);

But not I get a SQL Message -802 Engine code 335544321
arithmetic exception, numeric overflow, or string exception

Or is there a limit or 10000 for strings?