Search code examples
sqloracle-databaseplsqltoadplsql-package

send http request in toad/pl sql periodically


I am new to PL SQL and currently working on a small procedure ment for logging. The goal of the procedure would be to recive some parameters from where-ever it's called and then to write those parameters in a table. This procedure would also have some defined period (2 minutes for example) after which it sends all parameters by an API request. So, for 2 minutes it get's the parameters, inserts them into a table, and after the 2 minutes have passed, sends all the parameters by an API. And after that, another 2 minutes, etc.

I know how to get the parameters, insert them and send them via an API, but I don't know how to implement the periodical sending of data.

Should I call some kind of a sleep function, or something like that? Any help would be great!


Solution

  • To me, it looks more like a two procedures task, not only one:

    • the first (current) will accept parameters and insert them into a table
    • the second (new one) will send data
      • how? Schedule a database job to run every 2 minutes. Use DBMS_SCHEDULER package to do that. Depending on a database version you use, it might even be a simpler DBMS_JOB (still efficient for what you have to do).