0
I am implementing a simple replication form of two tables or more. I have the table replication which has the table name to be replicated and id.
To feed the table replication I have a Rigger in each table that will be replicated by taking their information and inserting it into the table replication.
I know that in my Function I can use the OLD and NEW to take the fields from the table that fired Rigger, but I wanted, within Function (which will be run by Rigger) to take the name of the table that fired the event.
That’s possible?
Because it does not pass as parameter by Function?
function_rep('tabela_origem');
– Don't Panic
@Everson could be, except at Trigger how would I pass that parameter? Remembering that who will call the function is the Trigger which in turn is triggered by a table to which I want the name.
– Jack
@Everson I wanted something more generic like: ;
CREATE TRIGGER replica AFTER INSERT
ON teste1 FOR EACH ROW 
EXECUTE PROCEDURE inserir_em_replicacao(old.nome_tabela);
Ai I could run this Trigger in the database only by changing the table name in the header.– Jack