I'm hoping you could help me
I have a client who I develop an application for, and my development required an upgrade from Oracle 10g to Oracle 11g. As I was doing such a major upgrade, I decided to upgrade everything (i.e. apex, tomcat and listener, as well as 11g), which has unfortunately caused some errors as I'll detail below
My old environment was Oracle Database 10.2g XE, Apex 4.0.1, Tomcat 7.0.5, Apex Listener 1.1.3. My new environment is Oracle DB 11.2g XE, Apex 4.2.4, Tomcat 7.0.50 and Apex Listener 2.0.5.
Everything went smoothly, until I tried to use the HTP package by trying to execute HTP.P. On execution of HTP.P, a window is supposed to open via JavaScript embedded in the code, however nothing happened apart from the page reloading itself. The code I attempted to execute via a button click is shown below
DECLARE
numf NUMBER;
x VARCHAR2(250) := 'window.open("f?p=102:0:&SESSION:PRINT_REPORT=Revised%20Stock%20Req%20Print")';
y VARCHAR2(250) := 'alert("No unprinted stock items found - cannot execute stock print request")';
z VARCHAR2(250) := ' window.location.href= "f?p=102:40:&SESSION"';
BEGIN
select count(*) into numf from transaction_detail where transaction_header_no in (select transaction_code from transaction_header where authority_batch_no = :P40_AUTH_BATCH_NUMBER) and transaction_source_table = 'STOCK_ITEMS' and transaction_total > 0 and Date_Printed is NULL;
if numf > 0 then
update transaction_detail set Req_Printed='Y', Date_Printed=:P40_TIMESTAMP where transaction_header_no in (select transaction_code from transaction_header where authority_batch_no = :P40_AUTH_BATCH_NUMBER and auth_check_back='Y') and transaction_source_table = 'STOCK_ITEMS' and Date_Printed is NULL;
COMMIT WORK;
htp.script (x, 'Javascript');
htp.script (z, 'Javascript');
ELSE
htp.script (y,'Javascript');
htp.script (z, 'JavaScript');
END IF;
END;
As you can hopefully tell, if the number of transactions (numf) > 0, then it is meant to open a new window with a report, and if not then it is meant to display the message. However it just reloads the page without displaying a message or anything. I've viewed Apex debugs that show the code attempting to be executed (and the debugs have no error), which is leading me to think that there is something I need to set up for the packages to run.
I've loaded the HTP and UTL_HTTP packages (via @utlhttp.sql and @pubht.sql commands)I've granted ALL privileges to the schema and APEX_040200 user on the HTP and UTL_HTTP packages, however nothing seems to be able to open the window. No other config to the Listener (apart from basic config of the port, database sid and so on) has been done.
Any help or advice would be greatly appreciated.
Kind Regards, DazzaRPD
EDIT: The code worked in 10.2g using htp.p instead of htp.script, In 11g I have tested it using htp.p to no avail. The code is executed once a button is pushed, and is in the Processing branch of Apex. The code itself is executed 'On Submit, after Computations and Validations'. The Page Reload isn't done by the window.location.href