Calling same plsql Procedure more than once in a package parallely - plsql

Have one plsql package "OMX_BEACON_MIG" where am calling
PROCEDURE handle_NR_Site(
i_old_plan_inst_id NUMBER,
i_new_plan_inst_id NUMBER,
i_old_act_id NUMBER,
i_new_act_id NUMBER )
To process action ids i.e., if i have 4 action id's then i am calling this procedure 4 times since " i_old_plan_inst_id" , "i_new_plan_inst_id","i_old_act_id","i_new_act_id" are different for every action.
Is there any solution where i can call this procedure only once and all the 4 actions are processed ate once?
Or is there anyway to carry out calling this function parallely instead of calling one by one?
Please guide.

Oracle has a very nice utility dbms_scheduler to run jobs in parallel . You can call the below function four times with different parameters to execute them in parallel.
dbms_scheduler.create_job(job_name => dbms_scheduler.generate_job_name('MY_JOB_'),
job_type => 'PLSQL_BLOCK',
job_action => 'begin handle_NR_Site(i_old_plan_inst_id => param1, i_new_plan_inst_id => param2, i_old_act_id => param3, i_new_act_id => param4 ); end;',
comments => 'Thread 1 descriptionn',
enabled => true,
auto_drop => true);
The jobs will run in background. Query the table DBA_SCHEDULER_JOB_RUN_DETAILS to get the execution status.
For more detailed explanation check the link:
https://oracle-base.com/articles/10g/scheduler-10g

Related

evanscli exit repeated fields [grpc]

Hi guys i have issue exiting repeated field, i tried ctrl-c ctrl-d and i am still cannot exit this.
The structure is:
Events
variant_set (field contain array of variant)
variant (field contain array of value)
value
in evans CLI this looks like this:
<repeated> event::variant_set::value (TYPE_STRING) => ctrl-c
<repeated> event::variant_set::value (TYPE_STRING) => ctrl-d
<repeated> event::variant_set::value (TYPE_STRING) =>
anyone knows how to exit this input ?
It can be avoided by specify --dig-manually option.
$ evans --proto api.proto repl
> call --dig-manually Unary
https://github.com/ktr0731/evans/issues/574

How can i efficiently query a table entry that matches either of words from Set in moor

I have a Set of String that contains words . The the Set can be of length 15 in average.
Am wondering if i can query the entries that contains either these words with moor's operand | efficiently without having to loop the Set like i have done here.
Future<List<Upload>> search(Set keys, List<Upload> result) async {
keys.forEach( (term) => (select(uploads)..where((tbl) => tbl.title.contains(term))) .get() .then((value) => result.addAll(value)), );
return SomeResult;
}
I can see that am running a single query multiple times.
Any help?
Thanks
I somehow found the solution here for anyone looking for same scenario
https://moor.simonbinder.eu/docs/getting-started/expressions/#in-and-not-in using .isIn list
Future<List<Upload>> search(List keys) => (select(uploads)..where((tbl) => tbl.title.isIn(keys))).get();

ADA - Searching a directory with a pattern - not returning as it should

This section of my program is supposed to list all files within the directory containing ".txt" in the name but it's not returning anything when run. If I delete ".txt" and leave it as an empty string "" then it works perfectly and returns all file names including the .txt files so I can't figure out what I'm doing wrong here.
procedure Search_Directory is
use Ada.Directories;
procedure Write_Search_Item(Search_Item : in Directory_Entry_Type) is
begin
Put(Item => Simple_Name(Directory_Entry => Search_Item));
New_Line;
end Write_Search_Item;
Filter : Constant Filter_Type := (Ordinary_File => True,
Special_File => False,
Directory => True);
begin
Search(Directory => Current_Directory,
Pattern => (".txt"),
Filter => Filter,
Process => Write_Search_Item'Access);
end Search_Directory;
The Search function, defined in the package Ada.Directories, takes a pattern argument which is either a null string or a form that is implementation-defined RM A.16 (111/ 2). In GNAT, this pattern is supposed to be a regular expression (see also here) described in System.Regexp (see also here, second grammar, a "globbing pattern").

Ada Maps: no visible subprogram matches the specification for "="

I've been using Ada.Containers.Indefinite_Hased_Maps to create my own custom hashed maps, and it worked quite well until I tried to use a vector as the element type. Here is an example of the problematic code:
package String_Vectors is new Ada.Containers.Vectors(Element_Type => Unbounded_String, Index_Type => Natural);
subtype String_Vector is String_Vectors.Vector;
package Positive2StringVector_HashMaps is new Ada.Containers.Indefinite_Hashed_Maps --Compiler fails here
(Element_Type => String_Vector,
Key_Type => Positive,
Hash => Positive_Hash,
Equivalent_Keys => Positive_Equal);
Basically, I cannot Positive2StringVector_HashMaps package, because the compiler comes up with:
no visible subprogram matches the specification for "="
From what I understand, it isn't finding the equality operator for the String_Vector , am I correct? If I am, what is the proper way of implementing it? And if I'm not, what am I doing wrong??
You don’t need to implement
function “=“ (L, R : String_Vectors.Vector) return Boolean
yourself, because there already is one in String_Vectors; see ALRM A.18.2(12). So you write
package Positive2StringVector_HashMaps is new Ada.Containers.Indefinite_Hashed_Maps
(Element_Type => String_Vector,
Key_Type => Positive,
Hash => Positive_Hash,
Equivalent_Keys => Positive_Equal,
“=“ => String_Vectors.”=");
By the way, is there some reason you used Ada.Containers.Vectors on Unbounded_String rather than Indefinite_Vectors on String? (wanting to change the length of a contained string would count as a Good Reason!)

define an argument value for a step in an Oracle job chain

I'm building a job chain in Oracle (11R2) DBMS Scheduler. The chain has two steps. Each step runs the same program, but with different arguments. I can see how how to define the chain, the steps, the rules, etc - but I cannot figure how to set the argument values for the steps.
When I build jobs that are single calls to programs, I set the arguments like this:
dbms_scheduler.set_job_argument_value(
job_name => 'MY_JOB',
argument_position => 1,
argument_value => 'foo');
My question is: Which dbms_scheduler func/proc would I call to set the arguments for a job step? Using the examples below, how would set an argument for 'STEP_1' in 'MY_CHAIN'?
Thanks,
John
DBMS_SCHEDULER.CREATE_CHAIN (
chain_name => 'MY_CHAIN',
rule_set_name => NULL,
evaluation_interval => NULL,
comments => 'Chain calls 2 steps. Same program but with different arg values.');
DBMS_SCHEDULER.DEFINE_CHAIN_STEP (
chain_name => 'MY_CHAIN',
step_name => 'STEP_1',
program_name => 'MY_PROGRAM');
DBMS_SCHEDULER.DEFINE_CHAIN_STEP (
chain_name => 'MY_CHAIN',
step_name => 'STEP_2',
program_name => 'MY_PROGRAM');
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'MY_CHAIN_JOB',
job_type => 'CHAIN',
job_action => 'MY_CHAIN',
repeat_interval => 'freq=daily;byhour=12;byminute=0;bysecond=0',
enabled => TRUE);
I believe that you'd have to define two different programs for this, although they can of course reference the same stored procedure or executable.
In the case o the former unless I'm going to be modifying the argument values I tend to use anonymous block program types to specify the arguments to stored procedures -- it's complex enough without adding in all that program argument stuff.

Resources