I'm struggling with a problem in Oracle 12.1 regarding to procedures.
We are using a data isolation approach based on schemas. We use one schema as PUBLIC and each project has exactly the same tables and procedures, but different data.
Problem: I need to get the schema name where the procedure was called in order to update a row for a table in the PUBLIC schema that holds all the different schemas.
CREATE OR REPLACE PACKAGE PKG_DONE
PROCEDURE ACK_FROM_WEB(UUID INTERNAL.UUID%TYPE, USERNAME PUBLIC.USERS.USER_NAME%TYPE);
CREATE OR REPLACE PACKAGE BODY PKG_DONE AS
PROCEDURE ACK_FROM_WEB(P_UUID INTERNAL.UUID%TYPE, P_USERNAME PUBLIC.USERS.USER_NAME%TYPE)
INSERT INTO ACK_WEB_USER(UUID,USERNAME) VALUES (P_UUID,P_USERNAME);
UPDATE PUBLIC.ACK_CONFIRMATIONS SET ASSIGNED = P_USERNAME WHERE UUID = P_UUID AND SCHEMA_NAME = USER;
It works perfectly in our website as we set the session with the SCHEMA when operating, but now we need external confirmation, via email and it only works with PUBLIC schema for security reasons. I would like to retrieve the schema where I call the procedure instead of USER in the statement
UPDATE PUBLIC.ACK_CONFIRMATIONS SET ASSIGNED = P_USERNAME WHERE UUID = P_UUID AND SCHEMA_NAME = USER;.
Is there any command/dbms procedure or anything where I can get it?