JOB creation Like DBMS_JOB

Hi Team,

I have created procedure.
Now i want to execute the same procedure multiple time in simultaneously with different value of parameter .

Do we have such a facility here?

Note : In ORACLE PLSQL we can use DBMS_JOB to use to execute the above scenario.
This DBMS_JOB Can call the procedure with different value parameter. So all will execute simultaneously.

Kindly clarify

You can use a linux cron job or other external job scheduler to issue a CALL to your SP with different parameters, on a schedule.

Or, if you just want to do it as a one-shot thing, you can list a bunch of calls and source them, or write an SP or anonymous code block to call your SP with different parameters.

For example:

singlestore> delimiter //
singlestore> create procedure p(a int) as 
    -> begin
    -> echo select a as x;
    -> end //
Query OK, 1 row affected (0.01 sec)

singlestore> call p(3)//
+------+
| x    |
+------+
|    3 |
+------+
1 row in set (0.02 sec)

Query OK, 0 rows affected (0.02 sec)

singlestore> do
    -> begin
    -> for j in 1..3 loop
    ->   call p(j);
    -> end loop;
    -> end 
    -> //

+------+
| x    |
+------+
|    1 |
+------+
1 row in set (0.01 sec)

+------+
| x    |
+------+
|    2 |
+------+
1 row in set (0.01 sec)

+------+
| x    |
+------+
|    3 |
+------+
1 row in set (0.01 sec)

Query OK, 0 rows affected (0.01 sec)

Thanks for prompt reply.

But this wont give solution. Because i need to execute procedure in parallel (simultaneously).

The below piece of code will execute like, it will call p(1) then it will call p(2).

so p(2) will be execute after p(1) completion.

But i want to execute p(1) p(2) p(3) simultaneously . All the 3 call should execute at a time without depend on others. This is possible by DBMS_JOBS in Oracle. I need this in singlestore to achieve my logic.

begin
-> for j in 1…3 loop
-> call p(j);
-> end loop;
-> end

Now am working in windows system only.

Ah, I see. Yes, for now you’d have to use an external job scheduler or application to do that. You could start background jobs for each SP CALL, concurrently.

You could do it from Windows, or inside a Linux container or VM, which I assume you must be using. From the Linux container or VM, you could use cron. Cron jobs start in the background automatically.