Apex_plsql_job.submit_process job not Working through Apex

Hi,
I am using Apex 4.2 and Oracle DB 11g.
I have a process (which calls a procedure) to run on page load which is taking quiet some time (more than a min) so I thought of using Apex_Plsql_job API. It is submitting the job (though it is submitting the job to DBA_JOBS rather than APEX_PLSQL_JOBS as said by Doc which even disappears in no time from dba_jobs).
declare
l_sql VARCHAR2(4000);
l_job NUMBER;
begin
    l_sql := 'BEGIN Pkg.procedure(param1); END;';
    l_job := APEX_PLSQL_JOB.SUBMIT_PROCESS(p_sql => l_sql, p_status => 'Background process submitted');
end;
Now My issue is the procedure is not being called. Am I missing something. Can anyone help me pls.
Thanks,
Shoaib

Hi,
APEX_PLSQL_JOB package works just fine for me.
What I did check your code I think there is mistake. You have not declare parameter "param1" for job PL/SQL code
Maybe code should look like this
DECLARE
  l_sql VARCHAR2(4000);
  l_job NUMBER;
BEGIN
  l_sql := q'!DECLARE param1 VARCHAR2(255) := 'MY_VALUE'; BEGIN Pkg.procedure(param1); END;!';
  l_job := APEX_PLSQL_JOB.SUBMIT_PROCESS(p_sql => l_sql, p_status => 'Background process submitted');
END;
Or something like
DECLARE
  l_sql VARCHAR2(4000);
  l_job NUMBER;
BEGIN
  l_sql := 'BEGIN Pkg.procedure(' || Px_MY_ITEM || '); END;';
  l_job := APEX_PLSQL_JOB.SUBMIT_PROCESS(p_sql => l_sql, p_status => 'Background process submitted');
END;
Regards,
Jari

Similar Messages

  • Apex_plsql_job.submit_process job not showing up in apex_plsql_jobs table

    Hello ghurus,
    I am running APEX 3.1 on Oracle 10g 10.2.0.1 and am trying to run a potentially long running procedure in the background so the user doesn't have to sit and watch the hourglass.
    The button process has the following code:
    DECLARE
    return_code NUMBER;
    exec_stg VARCHAR2(4000);
    squote VARCHAR2(1) := chr(39);
    edit_cnt NUMBER;
    BEGIN
    SELECT COUNT(*)
    INTO edit_cnt
    FROM edit_history eh
    WHERE eh.rept_inst = :f104_curinst
    AND eh.rept_time_frame = :f104_curterm
    AND eh.submission = :f104_cursubm
    AND eh.edit_complete_dtm IS NULL;
    univdb.exception_logging.insert_log(0, 'NO SQL ERROR', 'apex_editsubm','count=' || to_char(edit_cnt));
    IF edit_cnt = 0
    THEN
    INSERT INTO univdb.edit_history
    (rept_inst,
    rept_time_frame,
    submission,
    audit_id)
    VALUES
    (:f104_curinst,
    :f104_curterm,
    :f104_cursubm,
    :app_user);
    COMMIT;
    univdb.exception_logging.insert_log(0, 'NO SQL ERROR', 'apex_editsubm',
    'insert row successful');
    exec_stg := 'univdb.edit_any_submission(' || squote || :f104_curinst ||
    squote || ', ' || squote || :f104_curterm || squote || ', ' ||
    squote || :f104_cursubm || squote || ', ' || squote ||
    :app_user || squote || ');';
    univdb.exception_logging.insert_log(0, 'NO SQL ERROR', 'apex_editsubm',exec_stg);
    return_code := apex_plsql_job.submit_process(exec_stg);
    univdb.exception_logging.insert_log(0, 'NO SQL ERROR', 'apex_editsubm','return_code=' || to_char(return_code));
    commit;
    END IF;
    END;
    The calls to exception_logging write a row to a table so I can see what's happening in the process and I get the following rows writte:
    count=0
    insert row successful
    univdb.edit_any_submission('UNIV', '200701', 'TEF', 'ELSA_LESLIE');
    return_code=103
    The last message implies to me that the job was successfully submitted but when I query the apex_plsql_jobs table, job 103 does not exist and the procedure never gets executed. The procedure does work when tested outside of APEX.
    I checked all of my grants according to the post in this thread and they are all there:
    Re: Missing apex_plsql_job in 3.1
    Does anyone have a suggestion?
    ...elsa

    Hi Elsa
    I am also having similar problems calling the APEX_PLSQL_JOB.SUBMIT_PROCESS as well where it doesn't insert into the APEX_PLSQL_JOBS table.
    I also noticed that you used SCHEDULER. One of the challenges we are having is when the user presses the submit button, the browser hangs and doesn't return the result set until the process is complete. This process can take 20 mins before the screen loads saying the process was finished. I have tried used DBMS_JOB as we aren't on 10g and can not use SCHEDULER, but still having that issue where the user has to wait 20 mins before the process finishes.
    Did you ever solve that problem where the user clicks the button and then a page is returned immediately while the job is firing away with scheduler
    Any help would be great and much appreciated.
    Thanks

  • Oracle dbms.set_role does not work in APEX application

    Hi, in our j2ee applications, we use secure application role. Basically, the data source use the app user schema to connect to the database. the app user only has create session privileges. the database logon trigger will copy a set of attribute to the local secure context. (ip address, session user, client id, application name). The applications explicitly invoke the stored procedure sec_mgr.set_role before any DMLs are executed.
    the sec_mgr.set_role will check the local context attribute , authorize the ip, application name, and set an appreciated role to this session based on session user.
    we want to apply the same framework to the APEX application. First, we change the paring schema to the app schema which only has create session privilege. then we put the plsql code in which sec_mgr.set_role is called in the application builder --> shared components ---> edit security attribute ---> Virtual Private Database (VPD).
    however, we got the error ORA-06565: cannot execute SET ROLE from within stored procedure
    the sec_mgr.set_role is defined as invoker's right(AUTHID CURRENT_USER)
    do i missing something in APEX to get it work?
    Thanks

    Please explain it does not work in APEX? Is the application updating tables that have a trigger? APEX does NOT override trigger actions. Is it possible the values your trigger is looking for are NOT available in your APEX application? Can you post the trigger code here for review?
    Thank you,
    Tony Miller
    Webster, TX
    What if you really were stalking a paranoid schizophrenic... Would they know?
    If this question is answered, please mark the thread as closed and assign points where earned..

  • IPod touch not working through USB in car

    Does anyone know how to resolve an issue with the new IPod Touch 4th gen just purchased not working through car stereo. Have a new Toyota camry touring. You can hear sound when connected when you slide to unlock or go into an app the sound goes through the speakers fine but the radio face says loading and won't go any further, if you then try to go to the music screen it says connected so you can't get into the music to try to play. Has anyone else had this problem and resolved it. Not sure if the software of the radio can be upgraded to suit maybe at service?? Not really sure. Any help would be great

    Have you contacted your auto dealer? Some users have reported problems with there car systems not worked with the latest iOS. I searched the iPod Touch forum for Toyota but did not find any previous posts concerning Toyota.
    Have you tried resetting your iPod:
    Press and hold the On/Off Sleep/Wake button and the Home
    button at the same time for at least ten seconds, until the Apple logo appears.

  • Authentication function not working in APEX but works in pl/sql

    Greetings, Jim here.
    I have written a very simple authentication funtion which uses the dbms_ldap package to authenticate using the userid and password from the login page.
    I've tested this function thru pl/sql and it returns true and false accordingly.
    I've created a custom authentication schema and in the authentication function I have return myfunction;
    The problem is, when called thru APEX, it appears to always return true and lets the login proceed, even if the password is correct. I know its using the function due to the fact that if I enter a bogus function as the authentication function, APEX spits up a message saying so.
    So, I know the function works, but I don't know why it does not work with APEX. Posting function below.
    CREATE OR REPLACE FUNCTION ODBS.CUSTAPEXLOGIN (p_username IN VARCHAR2,p_password IN VARCHAR2)
    RETURN BOOLEAN AS
    retval PLS_INTEGER;
    emp_session DBMS_LDAP.session;
    ldap_host VARCHAR2(256);
    ldap_port VARCHAR2(256);
    ldap_user VARCHAR2(256);
    ldap_passwd VARCHAR2(256);
    ldap_base VARCHAR2(256);
    BEGIN
    ldap_host := 'oraldap';
    ldap_port := '389';
    ldap_user := p_username;
    ldap_passwd := p_password;
    ldap_base := 'cn=users,dc=company,dc=com';
    emp_session := DBMS_LDAP.init(ldap_host,ldap_port);
    retval := DBMS_LDAP.simple_bind_s(emp_session,('cn=' || ldap_user || ',' || ldap_base),ldap_passwd);
    if retval = 0 then
    return true;
    else
    return false;
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    begin
    if sqlcode = -31202 then
    return false;
    end if;
    end;
    END;
    /

    Hi Jim,
    Can you clarify this -
    The problem is, when called thru APEX, it appears to always return true and lets the login >proceed, even if the password is correctThat implies you're saying your authentication function ALWAYS returns true? Is that correct? Also 'even if the password is correct' doesn't read correctly to me, did you mean 'even if the password is incorrect'?
    You then say -
    now the function works, but I don't know why it does not work with APEX.So by 'does not work' you mean in APEX it is always returning true therefore allowing you to login regardless of the username/password you use? Is that correct?

  • Switch Theme is not working in apex 4.2.Plz  help me out.........

    Hi.......
    Switching from one theme to another theme is not working in apex 4.2..............
    Thanx in advance

    Hi!
    Same problem.
    Upgraded from 4.1 -> 4.2.
    Change theme from slightly modified Green theme (in mine case 101 is number and original was 11, One level Tabs) to Theme 25 Blue Responsive.
    Login page for instance doesn have "Login Region" for instance (not in LOV). And all pages are softly said strange.
    All have DISPLAY problem described on "http://1.bp.blogspot.com/-GzseTk6Lpes/UHvJkg9GulI/AAAAAAAAHRQ/Wt406GGZADQ/s640/Screen+Shot+2012-10-15+at+10.25.29.png", but without many parts that Dmitri describe.
    Rg
    Damir

  • Select count(*) not working in Apex

    Hello,
    The following sql works in both SQL*Plus and Toad but not in apex.  The variable seems always to be 0 no matter what data I have on the table.
    Basically I try to flip the status from "Inactive" to "Active" only when there is no "Inactive" status left on the table.  Say there are 2 inactive statuses.
    If I delete one inactive status, the overall status should still be "Inactive".  However, with this code, it flips to "Active" status regardless. 
    I tried manually assign the variable to 1 and the status was not flipped.  Therefore, it sounds to me that the count(*) is not working in APEX.
    Does anyone experience this before? 
    Thanks in advance,
    Ning
    ===================================
    DECLARE
    v_status_count NUMBER;
    BEGIN
    UPDATE LGR_APP_STATUSES
    SET DELETED = 'Y'
    WHERE LGR_APP_STATUS_ID = :P42_LGR_APP_STATUS_ID;
    commit;
    select count(LGR_STATUS_ID) into v_status_count from LGR_APP_STATUSES
    where DELETED = 'N'
    and LGR_APPLICATION_ID = :p42_application_id
    and LGR_STATUS_ID in (3,8);
    IF (v_status_count = 0) THEN
    update lgr_applications
      set lgr_application_status = 'ACTIVE'
      where LGR_APPLICATION_ID = :P42_LGR_APPLICATION_ID;
    commit;
    END IF;
    END;

    Hi,
    In query you have used p42_application_id.
    Other statements use P42_LGR_APP_STATUS_ID
    Do you have that item? What is session state for that?
    Regards,
    Jari

  • Database Scheduled Jobs not working

    Hai All,
    In my database Scheduled database jobs not working , but it work manullay fine...
    All parameter are correct including job_queue_processes.. Where I can start troubleshoot for this problem.
    Oracle: Oracle 9.2.0.1.0
    Platform : AIX
    Please help ...
    Shiju

    did you enabled the job?Unlikely. DBMS_SCHEDULER was a 10g innovation and as the OP mentioned, they're on 9i.
    Oracle: Oracle 9.2.0.1.0Cheers, APC

  • Printing on HP PSC 1200 not working through WIN XP

    Hi! I have a windows PC which I have connected to an HP PSC 1200 printer. My other laptops can connect perfectly to the printer and print. I set up my Mac according to the instructions but I cannot print. In windows the que name is "Remote Downlevel Print" and it is immediately giving an error. I called apple care because my exact model wasn't there so they gave me a printer which used its same driver. I can print when I connect the printer to my USB on my MacBook Pro but it does not work through Windows. If anyone could provide me with some help that would be great. Thanks.

    I have a similar problem-Canon Pixma ip4000 wired to Dell desktop running Win 98 2nd ed.---- Desktop is wired to Netgear. --- I can access internet with mac book pro but not print-I could print wirelessly with Toshiba laptop running Win xp-called apple help and spent 2 hours trying to fix but we both gave up-I wonder if I could run a cable from the printer to the netgear---unfortunately no USB interface on the netgear router --so I would have to find a cable that is either USB or parallel on one side and eithernet on the other-does anyone know if this world work? If not I could buy a printer router that just takes care of the printer wirelessly-anyone know of a good one?

  • Interactive Reports not working with APEX listener

    Hi,
    I have posted this question APEX listener forum couple of weeks ago but very few responses.
    If any one from here can help then it would be great.
    Interactive Reports not working with APEX listener
    Best Regards,
    Baig

    Sorry for late response.
    It was a firewall issue

  • Router will not work through splitter

    I have a new router from Verizon as the wireless signal kept dropping on my old one. I've always had my stb and router connected through a splitter and it's worked fine. The new router they have sent me which is the latest actiontec router with two antennas and gig E routing capability will not work through a splitter but will work without the splitter. I've purchased a better splitter that will carry up to a 2.4ghz signal but it still doesn't work. Verizon tech refuse to send out an engineer to help me so I'd like to ask if anyone here can shed some light on my issue. I do have two other splitters in the chain due to having two additional stb's in other rooms. I've also tried the router split with one of my other stb's with no luck.

    Unfortunately, you may have simply been lucky previously.
    I assume you aren't trying to play protected content through the projector, that will never work.
    Assuming you aren't, you might try cycling through the resolutions.

  • Collective invoice not working through VF04

    Dear All,
    Good Day!!!
    Please share your suggestions on the below issue,
    Our user has created two sales orders with reference to a contract and created two deliveries. All partners and other header data and item data is same except goods issue date. If we try to creative collective invoice through VF04, it is not creating a single invoice, it is creating two invoices. If we try to create through VF01 it is creating collective invoice (Single invoice).
    Invoices will be creating through the batch job and it will create through VF04. Hence this splitting is a big problem for us.
    System has to create the collective invoice through VF04, even though the goods issue date is different (Which is working through VF01).
    We have checked the copy controls, but there are no restrictions for the T Codes (VF01 and VF04).
    Please suggest is there any way to create the collective invoice through VF04 even though the goods issue date is different. It should work as like VF01?.
    Thanks in advance.

    It is a standard that if the Actual GI date in deliveries are different, you will get invoice split.  In ECC6, if you execute VF04, you can see a tab "Default Data" which cannot be seen in 4.6.  Select this tab and maintain the billing date which you want and execute so that you will get one invoice against two deliveries.
    G. Lakshmipathi

  • Sys_context not working from APEX application / environment

    I am struggling to retrieve a user-defined context value using sys_context(...) from APEX application / environment
    I have created a global context to be used as a storage mechanism for log severity to be recorded.
    CREATE OR REPLACE CONTEXT PA_LOGGER_CTX USING PA_LOGGER ACCESSED GLOBALLY;It is seeded through a function pa_logger.set_severity(1) within the package pa_logger through (excerpt):
      dbms_session.set_context(c_ctx_context_label, c_ctx_severity_label, TO_CHAR(p_severity_in));
      with:
      c_ctx_context_label     CONSTANT NVARCHAR2(16) := 'PA_LOGGER_CTX';
      c_ctx_severity_label    CONSTANT NVARCHAR2(8) := 'SEVERITY';
      p_severity_in   IN  PLS_INTEGERusing the following from sqlplus, other DB-tools, works as expected:
    -- setting it
    BEGIN
      pa_logger.set_severity(2);
    END;
    -- displaying it
    SELECT sys_context('PA_LOGGER_CTX', 'SEVERITY') FROM DUAL;returns 2
    This works from different sessions, different users ... no problem.
    Using it from within an APEX (accessed via embedded gateway/XE11.2 or OHS/11.2.0.2.0 ) application or even from the "SQL Commands" from the APEX Workspace returns a NULL value for :
    SELECT sys_context('PA_LOGGER_CTX', 'SEVERITY') FROM DUAL;And
       SELECT value  FROM GLOBAL_CONTEXT WHERE NAMESPACE='PA_LOGGER_CTX' and ATTRIBUTE = 'SEVERITY';returns the right value, which obviously defies the purpose of using the CONTEXT.
    It is as well possible to set the CONTEXT to a different value, which is picked up outside APEX, but even so using sys_context does not work, always returning NULL
    As a note aside: using sys_context with a standard CONTEXT, e.g. SELECT sys_context('USERENV', 'NLS_DATE_FORMAT') from DUAL works without any problems.
    I guess I have a conceptual break somewhere. Does this have to do with the APEX user used, wrapping within the APEX environment, the way the context is defined ....
    Any help is appreciated.
    Many thanks,
    - Thomas

    Hi Rod,
    Thanks for the time to answer. Meanwhile I found some more hints on the subject (Retrieve values from my own global context in Apex and I do now understand the concept.
    I understand that I can even clear the specific CLIENT_IDENTIFIER by issuing a "dbms_session.clear_identifier()", which then subsequently works
    Looking at the CLIENT_IDENTIFIER as set by APEX it is "<apex_login_user><apex_session>";
    I understand it is set for every DISPLAY-SUBMIT it is reset by the APEX framework.
    Hence it is not sufficient to set it for a user session; it needs to be changed for every display-submit. I can achieve this through application processes, but I am really reluctant to do so, because I do not know, if APEX relies on the CLIENT_IDENTIFIER to be set the way it is done. I suspect a purpose behind this, causing me problems elsewhere. I post this as a seprate question as this question has been answered.
    On to your point about: Using a table variable. This is the way it works currently, but allegedly using the CONTEXT would give us for the logging configuration a performance gain of about 1 dimension..... but unfortunately other problems..
    Thanks!
    - Thomas

  • Apex Essential application is not working in Apex 4.0

    Hi,
    We recently upgrated from apex 3.2 to apex 4.0. After the upgrade the apex essentials (developed by Patrick Wolf and team) is not working.
    The application can be opened, but the pages look very odd as the icons are not displayed properly. The advisor and power search options can be run, however get the following error.
    " ORA-20555: Unknown dictionary view APEX_APPLICATION_PAGE_DA
    Return to application."
    Can it be only used in 3.x?. In order to run apex 4.0 what we need to do? We already deinstalled and reinstalled the application, but got the same error.
    Advance Thanks,
    Natarajan

    I haven't used 4.0 extensively, but get the impression that all that functionality is now built into 4.0, thus not requiring an external application any longer.

  • SkillBuilders Modal Page is not working in Apex 4.2

    Hi All,
    I am trying to set up an example in apex.oracle.com of an application developed in Apex 4.1 and the SkillBuilders Modal Page plug-in is not working.
    To show this situation, I created a simplified version of the application, with only two pages, in apex.oracle.com.
    Workspace: EDIAZJORGE
    Username: TEST
    Password: test123
    Application: 66464 - Modal Page Sample
    When Page 3 loads, a Dynamic Action is executed to open Page 2 (Interactive Report) as a modal page, but it is not working (the modal page does not open).
    Please notice that this is working in Apex 4.1, and the Embed in Frames property in my application is set to Allow.
    I appreciate any help.
    Thanks,
    Erick
    Edited by: ediazjorge on Jan 30, 2013 3:20 PM
    Bump!

    Erick,
    This is due to a change that was made to the Dynamic Actions framework in 4.2. The workaround for now is to change your event to resource load on the DOM window object.
    It's working now. In the next release of the plug-in you'll be able to go back to the Page Load (ready) event.
    Regards,
    Dan
    blog: http://DanielMcghan.us/
    work: http://SkillBuilders.com/APEX/

Maybe you are looking for