Skip to content
Advertisement

Disable trigger in another db(Oracle)

Can I create a procedure that disables a trigger in another database? I mean, can I disable it with a database link? I need it for importing data into a data warehouse

Advertisement

Answer

Yes, you can do that. Here’s how.

In a remote database (called ORCL), I’m creating a table and a trigger:

Furthermore, in the same (remote) database, I’m creating a procedure which will disable that trigger. It’ll use dynamic SQL as you can’t execute DDL in PL/SQL just like that:

Now, in a local database, I’m creating a database link to the ORCL database:

Does it work?

Yes, it does. Fine. Now, all you have to do is to call the remote procedure from the local database:

Let’s check the remote database’s trigger status:

DISABLED, as expected.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement