Home » Developer & Programmer » Precompilers, OCI & OCCI » Get OCCI exe UNIX PID in SQL/PLSQL (Oracle 19)
Get OCCI exe UNIX PID in SQL/PLSQL [message #687611] Fri, 14 April 2023 04:40 Go to next message
Messages: 59
Registered: January 2011
Location: india

We have an OCCI executable deployed at our business client’s OEL7.9 server.
Currently the code calls Oracle SQL Loader (via system() function) to load data from a csv file to a table.

Due to some design decision, we have been asked to take the UNIX PID of the OCCI executable run and set it in one of the table columns (only) for the rows being loaded by the specific SQL Loader run invoked by the OCCI executable run.

So, if parallel instances of OCCI executable are run, each instance must lead to setting the table column with UNIX PID of the instance.

We explored v$session and v$process but these do not seem to be the right objects to provide what we want. The spid is giving the PID of the Oracle application which facilitates the session. What we want is the unix PID of the OCCI executable run from which the SQL Loader is run.

We do not have the liberty to get rid of the SQL Loader and fire INSERTs instead to load the data.

So, I am not sure how to do it if we are using SQL Loader.
I know I can specify a PLSQL function for a column in SQL Loader control file so that the function returned value will be stored in the column but I do not know how a PLSQL function can obtain UNIX PID of the OCCI executable in this scenario.

Any tips/help is highly appreciated.

Re: Get OCCI exe UNIX PID in SQL/PLSQL [message #687614 is a reply to message #687611] Fri, 14 April 2023 05:28 Go to previous message
Michel Cadot
Messages: 68658
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

How Oracle would know the PID of something that is not connected to it? or is not executing the current statement?

What your OCCI program can do is to modify the SQL*Loader control file to put in it its own PID in the target column before invoking SQL*Loader.

Previous Topic: PRO*C Windows Visual Studio 2022
Next Topic: Error ORA-01480: trailing null missing from STR bind value
Goto Forum:

Current Time: Sun May 26 06:51:58 CDT 2024