Subject Using declared variable as table name fails
Author Zoltán Török
Hi,

I need to create a complex trigger after a delete statement.
The trigger looks like this:

SET TERM ^ ;

CREATE TRIGGER DELETE_OBJECT FOR OBJECTS
ACTIVE AFTER DELETE POSITION 0
AS
DECLARE VARIABLE LOCALENAME VARCHAR(32);
BEGIN

FOR
SELECT rdb$relation_name
FROM rdb$relations
WHERE rdb$view_blr is null AND (rdb$system_flag is null or
rdb$system_flag = 0) AND rdb$relation_name LIKE '__-__'
INTO :LOCALENAME
DO
BEGIN
DELETE FROM :LOCALENAME WHERE ID IN (SELECT OP.ID FROM
OBJECTPROPERTIES OP WHERE OP.OBJECT = OLD.ID );
END

DELETE FROM OBJECTPROPERTIES OP WHERE OP.OBJECT = OLD.ID;
END^

SET TERM ; ^


It says that 'Token unknown' on :LOCALENAME in the DELETE statement.

Using declared variables as table name is not allowed?

Regs,
Zolee


[Non-text portions of this message have been removed]