How can I call a SQL Server stored procedure from Oracle and retrieve a scalar return value?

I’m developing a PL/SQL solution in Oracle Database Enterprise Edition I’m calling stored procedures in Microsoft SQL Server 2014.

I am using DG4ODBC with the DBMS_HS_PASSTHROUGH package to call those stored procedures.

For stored procedures that return a tabular result set, I am able to use PARSE, FETCH_ROW, and GET_VALUE to retrieve the values. (My solution uses hard parsing, but it works for the volume we’re expecting. I’m open to tips if you know how I can use binds, but that’s not my question.)

DECLARE    sql_server_cursor_     BINARY_INTEGER;    sql_server_statement_  VARCHAR2(32767);    fetched_value_col1_    whatever_type_from_col1;    fetched_value_col2_    whatever_type_from_col2; BEGIN    sql_server_statement_ := 'EXEC "myDatabase"."dbo"."myProcedure" @p_one = N''' || sanitize__(my_argument_) || ''';';    sql_server_cursor_ := dbms_hs_passthrough.open_cursor@sql_server_link_;    dbms_hs_passthrough.parse@sql_server_link_(sql_server_cursor_, sql_server_statement_);    WHILE dbms_hs_passthrough.fetch_row@sql_server_link_(sql_server_cursor_) > 0    LOOP       dbms_hs_passthrough.get_value@sql_server_link_(sql_server_cursor_,  1, fetched_value_col1_);       dbms_hs_passthrough.get_value@sql_server_link_(sql_server_cursor_,  2, fetched_value_col2_);       dbms_output.put_line('fetched_value_col1_  ' || fetched_value_col1_);       dbms_output.put_line('fetched_value_col2_  ' || fetched_value_col2_);    END LOOP;    dbms_hs_passthrough.close_cursor@sql_server_link_(sql_server_cursor_); END; / 

I have a stored procedure in SQL Server that returns a scalar integer.

DECLARE @return_value int; EXEC @return_value = "myDatabase"."dbo"."myProcedure" @p_one = N'HelloWorld', @p_two = 42; SELECT @return_value; 

From Oracle, how would I call this procedure and retrieve that scalar value?

Does commit after a normal select can call any fsync or flush operations?

Coms counts taken at particular time for all 3 (insert,update,commit).

Com_inserts are in 1.1K  Com_updates are in 1.6k  Com_commit are in  10K 

When enabling general log, I could see after each selects there is a commit. Would this unnecessary commit can cause any fsync or any flush opertation to the server?


How to call WC()->session in a hook action?

I’ve got a custom WP plugin that handles data from WC and send it via form-7. This has always worked fine until some time and updates ago. I’m trying to fix it and it occurs to me that the WC->session is not available in the:


So I read in the answer of ClemC on this question (What's the difference between WC() and $ woocommerce) and I quote:

About your errors, you got them because $ woocommerce->session has not been set. WC initializes WC_Session_Handler only on frontend or CRON requests. Choose your action hook accordingly.

Ok this makes sense. But how can I force the WC() object to load like it’s on frontend and therefore the WC()->session is not empty anymore?

Ensure function has completed before allowing another Ajax call

I am updating an array saved in a users meta field using an ajax function.

The values added to the array are taken from the data-attributes within the tags which also act at the trigger to make the ajax call.

Whilst the function works 95% of the time, it can be a bit hit and miss whether the values save or not. I suspect this is because a user can fire these ajax calls too quickly and not give enough time for the original function call to save and update the meta field.

What would be the best method to ensure the ajax triggered function of updating the meta field value has been completed before allowing the function to run again?

Hope this makes sense – needless to say, please let me know if you need any more info.

Thanks in advance!!

Sample HTML

<div id="rjb_slots" class="slots">   <h5>Mon, 24th Aug 2020</h5>   <div class="slot">     <span class="time">10:30</span>     <a class="book" data-timestamp="1598265000" href="#"></a>   </div>   <div class="slot">     <span class="time">11:00</span>     <a class="booked" data-timestamp="1598266800" href="#"></a>   </div>   <div class="slot">     <span class="time">11:30</span>     <a class="booked" data-timestamp="1598268600" href="#"></a>   </div>   <div class="slot">     <span class="time">12:00</span>     <a class="book" data-timestamp="1598270400" href="#"></a>   </div>   <div class="slot">     <span class="time">12:30</span>     <a class="booked" data-timestamp="1598272200" href="#"></a>   </div>   <div class="slot">     <span class="time">13:00</span>     <a class="book" data-timestamp="1598274000" href="#"></a>   </div>   <div class="slot">     <span class="time">19:30</span>     <a class="book" data-timestamp="1598297400" href="#"></a>   </div> </div> 

Ajax .js

$  ('.slot').on('click', '', function(e) {   e.preventDefault();    var user   = $  ('#rjb_day').attr( 'data-user' );   var stamp  = $  (this).attr( 'data-timestamp' );       // console.log(bookCap);      $  (this).removeClass('book').addClass('booked');    $  .ajax({     type: 'POST',     url: ajax_object.ajaxurl,     data: {         action: 'rjb_make_diary_slots',         user: user,         stamp: stamp     },     success: function(data) {       // This outputs the result of the ajax request       console.log(data);     },     error: function(errorThrown){         console.log(errorThrown);     }   });      }); 

Function that updates the user metafield

add_action( 'wp_ajax_rjb_make_diary_slots', 'rjb_make_diary_slots' );  function rjb_make_diary_slots() {    $  user   = $  _POST['user'];    $  stamp  = array(               array(                  'rjb_cal_day'           => strtotime('today', $  _POST['stamp']),                 'rjb_cal_when'          => $  _POST['stamp'],                 'rjb_cal_position_id'   => '',                 'rjb_cal_candidate_id'  => ''               )             );    $  calendar   = get_user_meta( $  user, 'rjb_cal', true);   $  stamps     = !empty($  calendar) ? $  calendar : array();   $  new_stamp  = array_merge($  stamps, $  stamp);    usort($  new_stamp, function($  a, $  b) {     return $  a['rjb_cal_when'] <=> $  b['rjb_cal_when'];   });    update_user_meta( $  user, 'rjb_cal', $  new_stamp);    $  log = print_r($  stamp);    wp_die($  log);  } 

Example of a value stored in the rjb_cal user meta field

array (   [0] => array (     [rjb_cal_day] => 1598227200     [rjb_cal_when] => 1598266800     [rjb_cal_position_id] =>      [rjb_cal_candidate_id] =>    )   [1] => array (     [rjb_cal_day] => 1598227200     [rjb_cal_when] => 1598268600     [rjb_cal_position_id] =>      [rjb_cal_candidate_id] =>    )   [2] => array (     [rjb_cal_day] => 1598227200     [rjb_cal_when] => 1598272200     [rjb_cal_position_id] =>      [rjb_cal_candidate_id] =>    ) ) 

Call procedure inside procedure using dynamic sql modifying the parameters getting passed

I have to call a procedure inside a procedure and replace all single quotes inside the parameter to double quotes. Ex: When i call my original proc begin data(10,’"push’s the data"’);end; It throws error due to single quote and i cannot change the string manually at runtime by adding double quote like push”s. I tried replacing inside procedure but probably because the string is passed first it wont take changes.

I wish to call this procedure inside another and using maybe dynamic sql replace single quotes with double.

Something like this:

create procedure dynamic_proc begin execute immediate ‘begin data(id,’||’replace(string,CHR39,CHR39||CHR39)’ AS string)’||’ end;’ end;

So basically the parameter string which is being passed in procedure data needs to have all single quote replace with double at run time.

LWJGL GLFW hangs on native glfwInit call

For the past months I’ve been working on creating my own game engine for personal use in LWJGL using pieces here and there, especially from developer ThinMatrix’s rightfully credited code, to learn as much as I can while building it. Only recently there has been strange behavior happening when I launch the engine from IntelliJ for testing:

  • After about 6-10 individual times I click run, all subsequent runs suddenly take about 60 seconds for the window to appear.

  • Whenever I restart my PC this hanging resets and I have another 6-10 runs before it hangs everytime again.

  • I located the issue to glfwInit, more specifically at the call to the native method:

      @NativeType("int")   public static boolean glfwInit() {       long __functionAddress = Functions.Init;       return invokeI(__functionAddress) != 0; // Right here   } 
  • I also noticed that this issue only started when I attempted to implement text support in my engine using the STBTrueType library. It was perfectly fine before that. I tried removing the TrueType code but it didn’t fix it.

Here’s a list of things I’ve tried:

  • Clearing my temp folder in case a buggy or corrupted file was present.
  • Recompiling and rebuilding the entire LWJGL jars twice.
  • Building glfw.dll from the GLFW sources and replacing the glfw.dll in the native jars with the former.
  • Reinstalling Java and actually upgrading JDK versions (from 13.0.2 to 14.0.2)
  • Switching IDEs even if I suspected it wouldn’t work.
  • Updating my NVIDIA drivers, and reinstalling them.

I’m quite confused as to what it could be, and I’d be more than happy to share code, thread dumps, or debug info if you deem it necessary. Here is the Github repository with the latest, "faulty" code (fault in quotes because I’m not too sure the code is the problem.)

Thank you very much for any guidance.

P.S: Please tell me if this is better asked in StackOverflow instead of here.

How does a company check the password received from your phone keypad during a call?

I had to call customer service recently regarding my 401(k) and robo call in the beginning asked me to enter my social security number using the keypad followed by a # and then asked for my account password using the keypad followed by # where special characters are *.

If the passwords are stored as hashes in their database, how is it possible that they can compare your input and verify it matches the password stored?

Punched in through a keypad, Hunter21 becomes 48683721 which would be indistinguishable from gtmtd7b1. It does not seem reasonable to compare all possible combinations of 48683721 to the hash because when including special characters and capitalization, it becomes more complex.

My only thought would be that they are storing my password as plaintext and comparing my keypad entered value to it and that would be concerning. I suppose when I first create the password they could convert it to the keypad equivalent number and hash/store that.

Is this common practice?

Be Prepared – Caretaker Emergency Phone Number and Call Sheet

In the event that you haven’t done this yet, do it today! Spot all crisis telephone numbers on a piece of paper on your fridge or a conspicuous place where all can see it, as almost a telephone. Keep it in a fixed spot. Try not to let individuals wander off with it. Tape it set up in the event that you should. Numbers you should list: 911 (or your nation’s 911 proportional); poison control; a couple (or your) office and cell numbers; specialist, dental specialist, and veterinarian numbers; a family member, dear companion’s or neighbor’s telephone number; your home or potentially PC telephone numbers; your place of residence.
It very well may be unpleasant when there is a crisis so compose on a piece of paper what an individual should tell the administrator when they call 911. Keep this sheet close to the crisis telephone list. Taiwan Mobile Database
Test of what to compose for somebody thinking about your kid: This is (really compose, give your name). I am calling in light of the fact that (compose, say why). It includes a kid. The telephone number here is (really compose it in). The location here is (again compose it in). The meds they are taking are (compose it in). They are sensitive to (write in any prescriptions they are hypersensitive to assuming any). Their pediatricians name is (compose it in). What would it be advisable for me to do until you arrive?
Once in a while during a crisis the individual on the other line will need to know your name so they can utilize it to quiet you down. You may have more trust in an individual on the off chance that they utilize your name. It makes it increasingly close to home. Which sentence causes you to feel progressively like the individual on the opposite end is in your group? “Sarah I need you to open the airways…” “Ms. I need you to open the airways…”
Purchase a how-to-sheet for CPR and essential emergency treatment. Keep it close to the crisis telephone numbers. Everybody living in your home should know where the crisis telephone list, call sheet, and crisis CPR/First Aid diagram are put. Ensure all overseers know where they are. Here’s a thought, take your more established youngster with you when you take a CPR and fundamental emergency treatment class. They probably won’t have the option to get affirmed relying upon how old they are and where you live, however in any event in a crisis circumstance they can support you or their grandparents if need be.

Weird phone call [closed]

about a year ago I got a phone call from Africa and when i picked up i could hear weird music in the back, they played in different orders and it just sounded weird it was terrible like they didn’t know how to play. I said hello with no respond back so i hung up. Yesterday i got a weird phone call again but i didn’t pick up. they called a few times and then decided to text me saying that i had to pick up ASAP and that there’s a party. He called me babe like we were dating. Today they decided to keep calling so i picked up and the call was from Sweden (where i live) again no answer so i said hello but no one answered so i hung up.

i’m really confused about what is going on and if somebody have heard of something like this before?

Why do we call the class “Barbarians” instead of “Berserks” or “Berserkers”?

This is a history-of-gaming question, and it has to do with the name choice between Barbarian and Berserkers. Due to the race-and-class mixing and matching of many different gaming systems, you can get combinations of barbarians with very non-barbaric races. Examples could include: “High Elf Barbarian” and “Gnome Barbarian.” On the surface, these combinations seem unusual but otherwise OK. It gets worse when you grab a dictionary.

According to Merriam-Webster:


1: of or relating to a land, culture, or people alien and usually believed to be inferior to another land, culture, or people

2: lacking refinement, learning, or artistic or literary culture


1: an ancient Scandinavian warrior frenzied in battle and held to be invulnerable

2: one whose actions are recklessly defiant

If you look at the features of a “barbarian” class, in almost any system, you notice that they align better with the definition of a Berserk (or Berserker). This is reinforced when you read about berserkers in norse sagas. Furthermore, if you look at the linguistic roots of barbarians, it was used to refer to anyone who was not of a particular culture.

Why do we call these classes “Barbarians” instead of “Berserks” or “Berserkers”?