Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 I need to write a function that disables all the triggers on a given table

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-02-11 : 10:11:51
john writes "I have a problem - I'm a relative newbie with SQL and PL/SQL and I have an assignement for my Oracle DBA II course.

I need to write a function that disables all the triggers on a given table. The function should take a tablename and its owner as arguments (besides any other arguments you may need to include), and disables the triggers on it. If all triggers are successfully disabled, the function should return 1. Otherwise, it should return -1.

I need to write another function that takes an additional argument, which takes arguments 'ENABLE' or 'DISABLE' and either disables or enables all triggers on a table.

I've been able to write an SQL script that does this more or less, but I don't know how to do it in a PL/SQL function, where you can't do DDL, unless you use Dynamic SQL (which I don't know), and my PL/SQL skills need honing."
   

- Advertisement -