Subject | possible to CREATE a TRIGGER from a INSIDE? |
---|---|
Author | skander_sp |
Post date | 2005-10-27T11:12:13Z |
I'm trying to create a new trigger from INSIDE the database, trhough a
procedure using the EXECUTE STATEMENT
I create a string with all the syntax (really only a command)
trg=
'SET TERM ^ ; '||
'CREATE TRIGGER '||new.table||' for '||NEW.table||' '||
'AFTER '||CASE new.accion when 'A' then 'INSERT'
when 'M' then 'UPDATE'
when 'B' then 'DELETE' end||' '||
'POSITION 100 '||
'AS BEGIN '||
'EXECUTE PROCEDURE MY_PROCEDURE; '
'END ^ '||
'SET TERM ; ^ '
but when I try
EXECUTE STATEMENT trg
i got some kind of error
I try whithout "set term" comamnd but same result...
anyone know the way to DO it?
procedure using the EXECUTE STATEMENT
I create a string with all the syntax (really only a command)
trg=
'SET TERM ^ ; '||
'CREATE TRIGGER '||new.table||' for '||NEW.table||' '||
'AFTER '||CASE new.accion when 'A' then 'INSERT'
when 'M' then 'UPDATE'
when 'B' then 'DELETE' end||' '||
'POSITION 100 '||
'AS BEGIN '||
'EXECUTE PROCEDURE MY_PROCEDURE; '
'END ^ '||
'SET TERM ; ^ '
but when I try
EXECUTE STATEMENT trg
i got some kind of error
I try whithout "set term" comamnd but same result...
anyone know the way to DO it?