N.B, the problem I'm facing is not related to the business logic, but rather, with the stored procedured itself. it's a very weird problem I'm facing and I haven't had this kind of problem before.
I'm modifying a stored procedure written in PL/SQL - called "MY_STORED_PROC" - and, each time I change its content, the previous changes still in the result of the execution of the SP.
This is the sample of the stored procedure:
create or replace PROCEDURE MY_STORED_PROC
(
V_USER IN VARCHAR2 DEFAULT NULL,
V_NUMBER_PARAM IN NUMBER DEFAULT 0,
V_ORIGIN IN NUMBER DEFAULT 0
)
AS
CV_1 SYS_REFCURSOR;
V_SAMPLE NUMBER;
BEGIN
SELECT BAP.APA_CNAME
INTO V_USER_DB
FROM BH_APPLICATION_PARAM BAP
WHERE BAP.APA_NCODE = 84;
INSERT INTO T_DEBUG (ERR_LINE, MESSAGE_INFO)
SELECT ID, 'EXAMPLE_MESSAGE'
FROM <my_table>
WHERE <ID = 1>;
END MY_STORED_PROC;
In the previous structure, I have the EXAMPLE_MESSAGE string which is inserted in T_DEBUG table when this SP is executed and the condition is met.
Now, after change the EXAMPLE_MESSAGE string sample with another text and compile and execute the SP, the message EXAMPLE_MESSAGE still shows in the results.
I don't understand why - if only this SP has the given string sample and the table
T_DEBUGis truncated before the SP is called.
What I had tried:
- Execute
DELETE FROM T_DEBUG;andTRUNCATE TABLE T_DEBUGbefore calling the SP. - Execute
DROP PROCEDURE MY_STORED_PROC, then executeCREATE OR REPLACE PROCEDURE MY_STORED_PROC(with and without declaring the schema name) with the logic of the procedure changed completely. - Compile and "Compile for debug" the SP - i.e:
MY_STORED_PROCwith and without schema name.
Example:
CREATE OR REPLACE PROCEDURE <SCHEMA>.MY_STORED_PROC ...
CREATE OR REPLACE PROCEDURE MY_STORED_PROC ...
Modify the SP for truncate the table
T_DEBUG"which contains the string sample" - this action (before the SP makes any action "i.e. insert data in T_DEBUG").Dropping the stored procedure:
DROP PROCEDURE MY_STORED_PROC;and execute:CREATE OR REPLACE PROCEDURE <SCHEMA>.MY_STORED_PROC ....Check the
T_DEBUGtable and it does not contain any trigger - it's a single table with no additional features or characteristics (like indexes, triggers, back-up table(s), etc).Compile the (SP) with the following intentional exception:
-- Generate intentional DivisionByZero unhandled exception: /*SELECT 1/0 INTO V_SAMPLE FROM DUAL;*/
In the later point, the exception ORA-01476 is raised and, in my opinion, the SP is taking the changes, but, after all these changes, I cannot explain why the sample string stays (even changing the content of the SP).
- In (30/10/2020) I also added:
'SAMPLE - ' || TO_CHAR(SYSDATE)as a string sample, then removed, then compile the SP - without this code - and I still got this sample string with date of 30/10/2020 - date when I added such sample, despite the fact I executed this SP at 05/11/2020.
Is there any way to "refresh" the stored procedure or what other tests can be made for refresh this stored procedured?
I'm not the database administrator of this database, but, I could get more information for share with the DBA - I already explain my problem to they, but, no help has been provided.