views:

30

answers:

1

Question is following: I have an oracle trigger after row insert. From trigger, I want to call a php script and pass just inserted row fields as parameters.

Insert is coming from very old legacy application with a very little chance of looking at the source code. Rows are inserted frequently, could be batches of ~1000 rows at a time or could be one row in 30minutes, so checking this table every, let's say, 5 seconds is not an option.

So, Idea is to have oracle trigger, which would be triggered every time on insert and call my php script? Any ideas?

Thanks in advance...

A: 

When you say "php script" do you literally mean a command line script, or a chunk of php being run through apache/etc.

If its the former, then go with OMG Ponies. Otherwise I'd use UTL_HTTP to make the call to Apache/PHP. Actually, I'd probably consider going with this anyway ( updating your php/c# if needed ).

Just remember though.. Triggers are transactional... if you absolutely MUST call out from a trigger be aware that your trigger may run several times ( due to query restart ) and may rollback completely, resulting in your external (presumably non-transactional) php call now being invalid. If your php can't handle this then perhaps have your trigger creating a job or even a message into an AQ or something, this would also speed up handling, you probably don't really want your insert to be waiting on an external web call.

Matthew Watson