cancel
Showing results for 
Search instead for 
Did you mean: 

script for handling triggers and delete statements

Former Member
0 Kudos

Hello,

currently I'm facing a problem which I don't know how to deal with.

We need a script which deletes/disables two triggers first, then delete some data and afterwards create/enable the triggers again.

I didn't find a proper hint how to cover this with dbmcli, probably we have to use a "higher" language..?!?!

Is it possible at all to provide "dbmcli -i" with a file including sql statements like the example afterwards ?

Is it possible to disable/enable triggers or do I have to delete and create them ?

e.g.:

disable/drop trigger trig_a

disable/drop trigger trig_b

delete from a where....

delete from b where...

enable/create trigger trig_a...

...

enable/create trigger trig_b...

....

used maxDB version is 7.5.0.38

any hint appreciated....GERD.....

Accepted Solutions (1)

Accepted Solutions (1)

lbreddemann
Active Contributor
0 Kudos

Hi Gerd,

please be aware that DBMCLI is a DBMServer client, not a SQL client (although it can tunnel some sql through the DBMServer).

Better use SQLCLI for things like that.

And. no, you cannot switch triggers on and off - just drop and recreate them.

But you may specify the IGNORE TRIGGER keyword for the delete statements.

That way you can leave the triggers just as they are.

p.s.

Any reason to stay on super old 7.5 ?

regards,

Lars

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

there is no 'DISABLE TRIGGER' or similar available for MaxDB.

Therefore deleting them and re-installing may be the best/only way if you will have to delete maaaaaaaaaaany rows and do not want to execute the trigger(s).

But then one could ask why there IS a trigger for deletion if some deletions will be done correctly without using the trigger. But I hope, you really know what you are doing.

IGNORE TRIGGER can only be used within a trigger itself (to avoid endless-loops). This sentence is missing in the documents for delete/update. I will ask for correction.

Elke

Former Member
0 Kudos

Hello Elke, hello Lars,

thanks for the "ignore trigger" hint, it will cover this workaround.....and the only reason for that very old version is the huge testing-effort to upgrade

regards..GERD..

Former Member
0 Kudos

sorry,

I replied too early

As Elke mentioned it doesn't solve our problem, since it cannot be used in delete's....

Former Member
0 Kudos

Hi,

there is no 'DISABLE TRIGGER' or similar available for MaxDB.

Therefore deleting them and re-installing may be the best/only way if you will have to delete maaaaaaaaaaany rows and do not want to execute the trigger(s).

But then one could ask why there IS a trigger for deletion if some deletions will be done correctly without using the trigger. But I hope, you really know what you are doing.

Elke