SQL trigger when a row is updated question

My problem is as follows.

I an creating a SQL database for a company that whenever a row is updated on the DB i want to have a trigger that calls a cURL request to transfer the updated information to our clients.

Is doing this the best way to do this? or is it better to do this in the php script that transfers the data to us?

Thank you for your time and experience.


first create one temp table , and create records whenever your updating row. for example if you are updating one row with id=24, save this id as refference id into temp table.then using Php if temp table contains any records call curl request and delete temp records once curl request is completed. by using cron jobs run this php scripts repeatedly

If your database is Oracle, the best way to do this is to create a packaged procedure encapsulating everything you want to happen. This would include both inserting the row and doing the http request. The Oracle user used by the php script can then be given execute privileges on this package allowing the script to call the procedure. Not only is this more clear, flexible, and secure, it also takes full advantage of the database software and avoids triggers.

I agree with the basic idea that Naisa had, but I would use a 'real' table instead of a 'temp' table in case the server goes down before you get a chance to process the rows. In addition, you might want to add a column with the sysdatetime() so you can process the rows in the 'order' they were presented to the system.

Category: sql Time: 2016-07-28 Views: 3
Tags: php sql trigger

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C) avrocks.com, All Rights Reserved.

processed in 1.184 (s). 13 q(s)