Skip to Main Content
  • Questions
  • Passing values of :new and :old from a Trigger to a Procedure

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Wellyton .

Asked: August 18, 2020 - 5:03 pm UTC

Last updated: August 20, 2020 - 9:56 am UTC

Version: 12

Viewed 1000+ times

You Asked

Hello Tom,

I am working in a project with the goal of creating a new structure to our database
where we want to be able to manage the resources in a better way.
And separate the objects that we are creating from those that ours clients developers.
And the idea that we have is to crate a single trigger in each table that will serve us as a dispatcher to other business rules that our clients need.
And each of those rules would be inside a procedure that our trigger would be calling and controlling the time spent and resources.



Is this even possible?
We tried to came up with some examples to pass those information to the procedure but we don't know if this is a good practice
or/and if this will work on cases where we have multiple row being change and large field as clob and blob?
How would that affect our system?

Can you give me some idea if this strategy is a good one to take?

and Chris said...

I'm unclear exactly what you're trying to do here, but from:

And each of those rules would be inside a procedure that our trigger would be calling and controlling the time spent and resources.

It sounds like you're trying to limit how long a query can run for, how much CPU it can use, etc.

In which case you should be looking at Database Resource Manager, not rolling your own!

https://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-resources-with-oracle-database-resource-manager.html#GUID-2BEF5482-CF97-4A85-BD90-9195E41E74EF

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

There is just one more thing

Wellyton Rodrigues, August 19, 2020 - 5:37 pm UTC

Your response was great but this one covers the control of CPU and executing time.

The other challenger that I have to solve is to make a structure to pass the :old and :new pseudo-records to procedures.

Do you have any idea how to do this?

Without passing all new and old columns?
Chris Saxon
August 20, 2020 - 9:56 am UTC

Without passing all new and old columns?

I believe you have to pass all the columns - or use these to initialize a record variable in the trigger and pass that.

More to Explore

Performance

Get all the information about database performance in the Database Performance guide.