每当通过Oracle DB触发器在TEST_TABLE上发生插入或更新时,我都会使用以下代码来调用http调用
create or replace TRIGGER TEST_TABLE_TRIGGER
AFTER INSERT OR UPDATE OF VALUE ON TEST_TABLE
for each row
DECLARE
req utl_http.req;
res utl_http.resp;
url varchar2(100) := 'http://{serverIP}:8086/testMethod';
BEGIN
-- need to pass current row to the http method
req := utl_http.begin_request(url, 'GET',' HTTP/1.1');
utl_http.set_header(req, 'content-type', 'application/json');
res := utl_http.get_response(req);
utl_http.end_response(res);
END;
如何将新添加/更新的行作为参数传递给http请求?正在调用的Http请求是Java RESTful Web服务,其中我将在其中处理新添加/更新的行。
可以在触发器中像:new.column_name一样引用新行或更新行中的列。您必须自己构建JSON有效负载并将其放置在标头中。