Apex_Util.Prepare_URL  Question due to Apex Util Advisor msg

Hi,
I have the following code in an SQL statement within an IRR:
APEX_UTIL.PREPARE_URL( p_url => 'f?p=' || v('APP_ID') || ':398:'||v('APP_SESSION')||'::NO:398:P398_IDOBJ:||VIMG_SEARCH.IDOBJ:', p_checksum_type => 'SESSION') FullImg,
And it works as expected. However when i run the Apex Util Advisor I get the following:
Attribute     Region Source (Identifies the source of the region, reference Region Source Type)
Check     V Function used in SQL Statements
Category     Performance
Message     Contains V/NV/DV function call in SQL statement (can be a performance problem).
Do I need to worry about this ? or should I change the syntaxt within the APEX_UTIL.PREPARE_URL parameters ?
Thank you
Daniel

In SQL (and PL/SQL blocks within APEX) the bind variable notation should be used:
APEX_UTIL.PREPARE_URL( p_url => 'f?p=' || :APP_ID || ':398:'||:APP_SESSION||'::NO:398:P398_IDOBJ:||VIMG_SEARCH.IDOBJ:', p_checksum_type => 'SESSION') FullImg,The <tt>v(...)</tt> notation is for use in database PL/SQL program units called from APEX.

Similar Messages

  • Apex_util.prepare_url from PL/SQL (outside APEX)

    Hello there,
    I have to create a job that sends emails with a link to a page with SSP actived and that requires authentification.
    I've read those threads from Dan and Omar and I wonder if this is still possible in APEX 4.2.1?
    Re: apex_util.prepare_url outside of ApEx
    Create APEX session context from outside APEX (plsql)
    My procedure generate the link with the checksum, but when I try to access the page I got an error :
    •is_internal_error: true
    •apex_error_code: APEX.SESSION_STATE.SSP_VIOLATION2_FOR_DEVELOPERS
    •error_backtrace: ----- PL/SQL Call Stack -----
      object      line  object
      handle    number  name
    0x69e9c2e8       548  package body APEX_040200.WWV_FLOW_ERROR
    0x69e9c2e8       599  package body APEX_040200.WWV_FLOW_ERROR
    0x69e9c2e8       903  package body APEX_040200.WWV_FLOW_ERROR
    0x6e5ff258      6025  package body APEX_040200.WWV_FLOW
    0x73cbd318       249  procedure APEX_040200.F
    0x6bdb2dd0        31  anonymous blockHere is my proc (code found in Omar's thread).
    Maybe I'm missing something.
    CREATE OR REPLACE procedure testInitApexFromOutside
          ( i_app_id     in number
          , i_page_id      in number
          , i_apex_user    in varchar2
          ) is
        v_cgivar_name  owa.vc_arr;
        v_cgivar_val   owa.vc_arr;
        v_workspace_id NUMBER;
        v_app_id       number;
          BEGIN
        -- set up cgi environment
        htp.init;
        v_cgivar_name(1) := 'REQUEST_PROTOCOL';
        v_cgivar_val(1)  := 'HTTP';
        owa.init_cgi_env
          ( num_params => v_cgivar_name.count
          , param_name => v_cgivar_name
          , param_val  => v_cgivar_val
        -- load apex IDs by application name
        SELECT workspace_id,
               application_id
        INTO v_workspace_id,
             v_app_id
        FROM apex_applications
        WHERE application_id=i_app_id;
        -- set up apex workspace
        wwv_flow_api.set_security_group_id(v_workspace_id);
        -- set up apex session vars
         apex_application.g_instance     := wwv_flow_custom_auth.get_next_session_id;
        apex_application.g_flow_id      := v_app_id;
        apex_application.g_flow_step_id := i_page_id;
        -- "login"
        apex_custom_auth.define_user_session
          ( p_user       => i_apex_user
          , p_session_id => apex_application.g_instance
        wwv_flow_custom_auth_std.post_login
          ( p_uname      => i_apex_user
          , p_session_id => apex_application.g_instance
          , p_flow_page  => apex_application.g_flow_id
                         || ':'
                         || apex_application.g_flow_step_id
          -- set array of protected page IDs for session state protection
         apex_application.g_protected_page_ids(1) := '1500';    -- this establishes page 1500 as an SSP-protected page
        dbms_output.put_line(APEX_UTIL.PREPARE_URL('f?p='||i_app_id||':'||i_page_id||':::NO:1500:P1500_PEV_SEQ_NO:18137',2));
    end testInitApexFromOutside;And the result:
    f?p=128:1500:::NO:1500:P1500_PEV_SEQ_NO:18137&cs=3B3D5905A7DDBCB5520E8F88885169CAC
    Thanks for your help,
    Lucien

    See Re: Link in report ?
    Maarten

  • APEX_UTIL.PREPARE_URL does not work across workspaces?

    We are running ApEx 4.1.1 on Oracle 11g.
    I am trying to call an application in another workspace and am using APEX_UTIL.PREPARE_URL in a hidden item and then a button with REDIRECT TO URL using javascript:popUp2 which uses the hidden item (the returned value of the PREPARE_URL. The code works fine if I am in the same workspace and a checksum is returned:
    APEX_UTIL.PREPARE_URL('f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION');
    returns:
    f?p=9002:2:1400894538262901::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:9001,FRD_MASTER_BANSECR&c=STU_WS&cs=3190FB9A8CC967E5B3CED03460DF6F291
    I can press the button and app 9002 opens in a new window.
    When I try the same code in an application in another workspace, no checksum is returned:
    APEX_UTIL.PREPARE_URL('f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION');
    returns:
    f?p=9002:2:8288147979401::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:112,Testing_Template&c=STU_WS
    and I get the error:
    Error     Session state protection violation: This may be caused by manual alteration of a URL containing a checksum or by using a link with an incorrect or missing checksum.
    I have also tried it without the workspace '&c=STU_WS' and explicitly passing the parameters, but no checksum is returned.
    APEX_UTIL.PREPARE_URL(p_url => 'f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.',p_checksum_type => 'SESSION')
    If I do not try to pass any parameters, no checksum is produced, but the button successfully opens app 9002 in a new window:
    APEX_UTIL.PREPARE_URL('f?p=9002:4:&SESSION.::NO::&c=STU_WS','SESSION');
    returns:
    f?p=9002:4:8288147979401::NO:::&c=STU_WS
    Again, the above code successfully opens app 9002 in a new window. In fact, when not passing parameters to app 9002, I would not seem to need to use PREPARE_URL.
    BUT. I do need to pass the calling app id and the calling app name to app 9002, because 9002 looks up information about the calling app. Since, I must pass parameters, I must use PREPARE_URL, and it does not seem to work when you call it for an app in a different workspace.
    Given all of the above, I have found a kludge. I call PREPARE_URL using the APP_ID of the current app and then replace that APP_ID with 9002.
    replace(APEX_UTIL.PREPARE_URL('f?p=&APP_ID.:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION'),
    'f?p=&APP_ID.:2','f?p=9002:2')
    returns:
    f?p=9002:2:8288147979401::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:112,Testing_Template&c=STU_WS&cs=33B2BB2ECFE3555198CE3325CCF9F67B8
    And the button opens app 9002 just fine.
    Is there anyway to get PREPARE_URL to work with apps in another workspace? What am I missing? Is there a better way than the kludge I came up with?
    A little more information: my app 9002 is a help & info for ApEx DBAs and Developers. It is my attempt at code reuse. Calls to 9002 are in a master template. I can continually update and change the help in 9002 without having to update the apps that call it.
    Thanks for your help,
    Chris

    lewisc3 wrote:
    We are running ApEx 4.1.1 on Oracle 11g.
    I am trying to call an application in another workspace and am using APEX_UTIL.PREPARE_URL in a hidden item and then a button with REDIRECT TO URL using javascript:popUp2 which uses the hidden item (the returned value of the PREPARE_URL. The code works fine if I am in the same workspace and a checksum is returned:
    APEX_UTIL.PREPARE_URL('f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION');
    returns:
    f?p=9002:2:1400894538262901::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:9001,FRD_MASTER_BANSECR&c=STU_WS&cs=3190FB9A8CC967E5B3CED03460DF6F291
    I can press the button and app 9002 opens in a new window.
    When I try the same code in an application in another workspace, no checksum is returned:
    APEX_UTIL.PREPARE_URL('f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION');
    returns:
    f?p=9002:2:8288147979401::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:112,Testing_Template&c=STU_WS
    and I get the error:
    Error     Session state protection violation: This may be caused by manual alteration of a URL containing a checksum or by using a link with an incorrect or missing checksum.
    I have also tried it without the workspace '&c=STU_WS' and explicitly passing the parameters, but no checksum is returned.
    APEX_UTIL.PREPARE_URL(p_url => 'f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.',p_checksum_type => 'SESSION')
    If I do not try to pass any parameters, no checksum is produced, but the button successfully opens app 9002 in a new window:
    APEX_UTIL.PREPARE_URL('f?p=9002:4:&SESSION.::NO::&c=STU_WS','SESSION');This is wrong because you are passing string SESSION for url_charset parameter, that's why id is not adding any checksum
    See this http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/apex_util.htm#AEAPI160
    returns:
    f?p=9002:4:8288147979401::NO:::&c=STU_WS
    Again, the above code successfully opens app 9002 in a new window. In fact, when not passing parameters to app 9002, I would not seem to need to use PREPARE_URL.
    BUT. I do need to pass the calling app id and the calling app name to app 9002, because 9002 looks up information about the calling app. Since, I must pass parameters, I must use PREPARE_URL, and it does not seem to work when you call it for an app in a different workspace.
    Given all of the above, I have found a kludge. I call PREPARE_URL using the APP_ID of the current app and then replace that APP_ID with 9002.
    replace(APEX_UTIL.PREPARE_URL('f?p=&APP_ID.:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION'),
    'f?p=&APP_ID.:2','f?p=9002:2')
    returns:
    f?p=9002:2:8288147979401::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:112,Testing_Template&c=STU_WS&cs=33B2BB2ECFE3555198CE3325CCF9F67B8
    And the button opens app 9002 just fine.
    Is there anyway to get PREPARE_URL to work with apps in another workspace? What am I missing? Is there a better way than the kludge I came up with?
    A little more information: my app 9002 is a help & info for ApEx DBAs and Developers. It is my attempt at code reuse. Calls to 9002 are in a master template. I can continually update and change the help in 9002 without having to update the apps that call it.
    Review all above API calls and make sure you pass right parameters

  • Trouble getting  apex_util.prepare_url to produce checksum

    Session State Protection is enabled in both apps & Page attribute "Page access protection" is set to "Arguments Must have Checksum"
    Does not give checksum...
    http://apex.oracle.com/pls/apex/f?p=34780:3
    I even went into SSP and had it enabled for all page items and pages and still doesn't make a difference.
    Select 'x', APEX_UTIL.PREPARE_URL ('f?p='||:APP_ID || ':1::' || :APP_SESSION || '::::P1_EMPNO:' ) employee_link from dual;
    Different app Same Query... Provices checksum
    http://apex.oracle.com/pls/apex/f?p=39900:3
    Select 'x', APEX_UTIL.PREPARE_URL ('f?p='||:APP_ID || ':1::' || :APP_SESSION || '::::P1_EMPNO:' ) employee_link from dual;
    Any Ideas?
    Justin
    workspace:epic

    OK.. seems to me that:
    Justin Patterson wrote:
    Does not give checksum...
    http://apex.oracle.com/pls/apex/f?p=34780:3
    SSP Screenshot
    http://tinypic.com/r/k4fjvc/7
    This has no page 1, therefore no checksum would be generated ;).
    >
    Different app Same Query... Provices checksum
    http://apex.oracle.com/pls/apex/f?p=39900:3
    SSP Screenshot
    http://tinypic.com/r/5fnst2/7
    This has page 1, therefore checksum is generated.
    Also, the app_session is in the wrong place.
    Ta,
    Trent

  • APEX_UTIL.PREPARE_URL cannot produce checksum

    Hi, Guys:
    I tried to use APEX to generate checksum for url, but it does not work, no checksum is generated. I was confused. Culd anyone tell me what is the problem? here is my code:
    DECLARE
        l_url varchar2(2000);
    BEGIN
        :P1_TF_CHECKSUM:= APEX_UTIL.PREPARE_URL('f?p='||:APP_ID||':12:'||:APP_SESSION||'::NO::P12_ACE_ID:xyz', p_checksum_type => 'SESSION');
    END;You can find my application on apex.oracle.com:
    workspace: LIAPEXTEST
    acc:[email protected]
    pwd:lxus2000
    app_ID: 44976
    Thanks!

    Hi,
    My understanding is that the checksum will only be generated if there is some sort of session state protection enabled, on the items you are trying to set through the URL. (Probably if the page has some sort of protection as well)
    For example, the text item you have on page 1 has the security setting: "Checksum required - session level".
    So I copied your page process, and attempted to set that page item in the process - now you will see the checksum generated.
    On the original process (currently disabled), for which you are setting an item that doesn't exist, and thus has no session state protection, therefore no checksum is needed.

  • Apex_util.prepare_url within a select statement

    APEX Version: 3.1.2.00.02
    Need help with embedding APEX_UTIL.PREPARE_URL in select statement. Unable to reference column name as a bind variable...or it allows as in code below, but no values are included in the URL. Using PREPARE_URL so checksum is created.
    URL created:*
    https://.../f?p=108:90:623968923157010::NO::P90_RID:&cs=3CB12F3B467B3989B51377487817BDB08
    Note: href >> replaced with >> hrf
    declare
       q           varchar2(32767);      -- query
       w           varchar2(4000) ;      -- where clause
       we          varchar2(1) := 'N';  -- identifies if where clause exists
    begin
       q :=  'select "RID", '||
             '       "EMPLOYEE_NO", '||
             '       InitCap(first_name)||
             '||''' '''||
             '||InitCap(last_name) as "Name", '||
             '       "HIRE_DATE", '||
             '       "JOB_TITLE", '||
             '       CASE '||
             '          WHEN CORRECTION_IND = 'X' '||
             '             THEN ''<a hrf="' ||
    apex_util.prepare_url('f?p='||:APP_ID||':90:'||:APP_SESSION||'::'||:DEBUG||'::P90_RID:'||:RID) ||
             '">Correction</a>'' '  ||
             '          ELSE    NULL '||  
             '       END CORRECTED '||
             '  from "#OWNER#"."EMPLOYEE_TABLE" ';
       if :P28_FIRST_NAME IS NOT NULL
          then
             w := w || ' AND first_name LIKE UPPER(:P28_FIRST_NAME||'||'''%''' ||')' ;
             we := 'Y';
       end if;
       if :P28_LAST_NAME IS NOT NULL
          then
             w := w || ' AND last_name LIKE UPPER(:P28_LAST_NAME||'||'''%''' ||')' ;
             we := 'Y';
       end if;
       if we = 'Y'
          then q := q || w;
       end if;
    return q;
    end;Edited by: JSandoval on May 25, 2011 1:03 PM

    I think that the problem is that the function apex_util.prepare_url is executed building the "q" variable, not during query execution. (you have to try to quote it ...)
    I often use the "Query from function".
    There a couple of things that helps me:
    - I always put in the page an item PXX_SHOW_SQL(checkbox) visible only to administrator (a user setting in my application...).
    Before the "return q" put a htp.p(q) if this Item is not null. So you can see the actual SQL (often helps reformattig the output with SqlDeveloper)
    - I'm became crasy tring to quote complex query ... Now I write the query code in a TABLE
    Example AUXSQL(APP_ID number,APP_PAGE number, PRG number, sql VARCHAR2(4000))
    More "PRG" if more than 4000 chars. (I start in this way, but someone use CBLOB ...)
    I find this very usefully!!
    Thanks
    Stefano Corradi

  • APEX_UTIL.PREPARE_URL with checksum

    Hi all,
    sorry to bring up this topic up again.
    I was trying to do what was discussed in the following thread, but it just couldn't work for me.
    APEX_UTIL.PREPARE_URL 0- cecksum parameter
    The link in my email did not have the checksum parameter though i have run it over the APEX_UTIL.prepare_url function
    I verify this using the toad debugger.
    and I use the following sql to test as well
          select apex_util.prepare_url('f?p=137:99::5:NO:5:P5_REQUESTSEQ:2010100246',null,3) from dualit only return that string back without any checksum parameter.
    Am I doing this wrongly?
    Appreciate any input.
    Thanks.
    -Joel

    Hi Jari,
    Should i have session id because the link will be used by other people whom is the recipient of the email?
    I was following the steps in the other thread I mentioned.
           So if the link you want them to use is f?p=100:1:::NO:RP:P1_X,P1_Y:abc,def and your new public page is 2, send them this link instead:f?p=100:2::1:NO:RP:P1_X,P1_Y:abc,def.Without the SSP, the redirection and joining existing session are working. So I guess order of the parameter in the URL is correct.
    Thanks
    -Joel

  • HT5312 I can not remember the answers to my security questions due to the fact my daughter set it up and she is not here

    I can not remember the answers to my security questions due to the fact my daughter set my account and she is not here

    You need to ask Apple to reset your security questions; ways of contacting them include clicking here and picking a method for your country, phoning AppleCare and asking for the Account Security team, and filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (102754)

  • TS3297 I cannot purchase music currently as I am being asked to answer security questions due to it being " the first time have bought from this PC". This is not the case, I have not changed my PC. I have changed my passowrd and security questions but no

    I cannot buy music currently as I am being asked to answer security questions due to it being supposedly "the first time I have bought form this PC". This is not the case. I have now changed my password and security questions, but it is asking me the same when I try to buy again.

    First off, the name of your computer is only the way it is becuase the Apple user is the first one they created after repairing the Mac. Go into Sharing System Preferences and change the name to whatever you like.
    Can you explain how you did this:
    This didn't seem right so I went in to it and changed the computer so that it would recognise me as the Owner/Administrator.
    You can delete the Apple user in Users & Groups System Prefs. Select that user and delete it. It will ask if you want to save the user data or delete it. If you archive it, you can always delete it later and it will be available if you need to recover that account for some reason--I doubt this will be necessary. After deleting the account, and when you feel you are still working normally, you could delete that archived user folder.
    I have also never seen anything ask for that. It does sound like an Epson thing, but without having access to it, I couldn't tell you for sure.
    Here's what I would try. Create a new User and give them admin rights. Log in as that user and see what happens with the installer. If it still complains, it is an Epson issue. My guess is it is looking for user id 501, the first user created. If it works, then something is indeed odd about your account. If so, use that new admin account to disable Admin privileges for your account, then re-enable it. This is done in the Users & Groups system prefs.

  • Apex_util.prepare_url

    Hi
    I have this sql, and need to add cs to the url... someone there know how I use apex_util.prepare_url() in a sql statement?
    My sql statment:
    http://vels.dk/tmp/sql.jpg
    (I have tryed to pass the code here, but it is not showed correct)

    See Re: Link in report ?
    Maarten

  • Several Questions about upgrading APEX

    Hello,
    I a several questions about upgrading APEX.
    I want to upgrade my APEX 2.0 to 2.2 and hopefully in a few month to 3.0.
    Is there a How To about upgrading APEX?
    What would happen to my applications?
    Would there be any problems about the applications when the APEX version is upgraded to another version?
    Thank you,
    Tim

    Tim,
    Yes there is (detailed) upgrade documentation provided with the upgrade itself, which you should definitely look through. The 2.2 and 2.2.1 releases are currently available here -
    http://www.oracle.com/technology/products/database/application_express/index.html
    You applications will be 'upgraded' as part of the upgrade process (i.e. they will continue to work with the new software once the upgrade is complete).

  • What is limit to load csv file for Apex Utility?

    What is limit to load csv file for Apex Utility?
    How many records can I load through apex load utility?
    I am loading csv files.
    Thank you.

    Hi,
    You download the report that is displayed in APEX which is limited to 65k. There may be some way of creating a custom file based off the table rather than using APEX's built in export to csv option but I don't know of any being released. Denes produced an export to .xls option but I don't know how many rows that caters too: http://htmldb.oracle.com/pls/otn/f?p=31517:108:1512181285516724::NO:: -- I assume 65k too though.
    Mike

  • Image is not displayed in APEX Form with APEX utility Function

    Dear APEX experts,
    As i am new to the oracle apex development. I have just created the basic employee information form in which i upload the photograph of the employee. The photograph gets uploaded but it does not display properly. I have already referred the sample database application to display the image. Moreover, i have followed the same steps as it is used to display the product image in that application. Still i am unable to get result. I am getting following output:
    <img src="apex_util.get_blob_file?a=35682&s=101496289174102&p=15&d=10639237623242912156&i=10639236703270912154&p_pk1=21&p_pk2=&p_ck=FCA12832591A1C706D76FDD589E551A2" />
    Please help me seniors to solve this issue. How to display the image using this utility.

    mehpandya wrote:
    I have observed following HTML code after inspecting the two application.
    1.Sample Database application:
    In this application , the product image is uploaded and displayed correctly and following code is rendered in the HTML source.
    <span id="P6_IMAGE" class="display_only" ><img src="apex_util.get_blob_file?a=64703&s=134073736366663&p=6&d=25732916709090782422&i=25433760606377189086&p_pk1=1&p_pk2=&p_ck=7E23190CC0BFE98BBE4CCE2ADFBBEF26" /></span>
    2.Sample HRMS Application - Which i have created for learning.
    In this application , the employee photo is uploaded but it is not displayed correctly. Following is code is rendered in the HTML.
    "<span id="P15_EMPIMG" class="display_only" >&lt;img src="apex_util.get_blob_file?a=35682&amp;s=100541516379272&amp;p=15&amp;d=10639237623242912156&amp;i=10639236703270912154&amp;p_pk1=21&amp;p_pk2=&amp;p_ck=31A8328E0F5754D7CBD0FC0C6313B38A" /&gt;</span>"
    Hence , in my application the code is not rendered perfectly and syntax is not completed.
    following characters are rendered like this.: &lt , &quot , &gt , &amp.
    So, is this the reason of not displaying the image???Yes.
    To get a Display Item to render as HTML, in the item definition Security section set Escape special characters to No.
    For a report column, ensure the Display Text As report column attribute is Standard Report Column rather than the default Display as Text (escape special characters).
    Use a Display Image item and declarative BLOB support instead of this clunky manual method.
    Please read the FAQ and forum sticky threads (if you haven't done so already.
    You'll get a faster, more effective response to your questions by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s)
    The APEX documentation is here.

  • Need to Programmatically Set IRR Filter on Date Field Due to APEX 4.1 Bug

    There may be another work around but, here is the problem that we are encountering...
    We have a huge table that is partitioned on a DATE field and an IRR that reports on this table. By default, we want to show the most recent 3 days of data. There is a built-in filter for "is in the last 3 Days." Sounds Great! Unfortunately APEX generates the code using TIMESTAMP rather than DATE functions. As a result of this, the query does not perform partition pruning and, as a consequence, it is doing a full table scan which takes forever. Note the use of the "LOCALTIMESTAMP" function in the query that is generated by APEX for this filter:
    SELECT   "BUSINESS_DATE",
             COUNT ( * ) OVER () AS apxws_row_cnt
      FROM   (SELECT   *
                FROM   (SELECT   *
                          FROM   position_delta_his p) r
               WHERE   ("BUSINESS_DATE" BETWEEN *LOCALTIMESTAMP*
                                                - NUMTOYMINTERVAL (:APXWS_EXPR_1,
                                                                   'year')
                                            AND  *LOCALTIMESTAMP*)) r
    WHERE   ROWNUM <= TO_NUMBER (:APXWS_MAX_ROW_CNT)If, instead, APEX used the SYSDATE function, as the underlying column is a DATE, this returns instantly, after partition pruning.
    SELECT   "BUSINESS_DATE",
             COUNT ( * ) OVER () AS apxws_row_cnt
      FROM   (SELECT   *
                FROM   (SELECT   *
                          FROM   position_delta_his p) r
               WHERE   ("BUSINESS_DATE" BETWEEN *SYSDATE*
                                                - NUMTOYMINTERVAL (:APXWS_EXPR_1,
                                                                   'year')
                                            AND  *SYSDATE*)) r
    WHERE   ROWNUM <= TO_NUMBER (:APXWS_MAX_ROW_CNT)
    The bug is that APEX should base the underlying function on the data type of the filtered column.
    As a work around, if we create a filter where BUSINESS_DATE >= '4/13/2012' (three business days ago), again, this returns instantaneously. The issue is that we can only set this filter by using the APEX GUI. We need to be able to:
    1. Determine the date for 3 business days ago
    2. Set this as the default filter.
    I tried creating a BEFORE HEADER PL/SQL page process but, it does not appear to be having any effect. Here is that code:
    DECLARE
        ldt_Filter DATE;
        CURSOR lcsr_GetMaxBusinessDate IS
            SELECT Max(BUSINESS_DATE)
            FROM POSITION_DELTA_HIS;
        DAYS_AGO CONSTANT NUMBER := 3;       
    BEGIN
        APEX_UTIL.IR_CLEAR( :APP_PAGE_ID );
        OPEN lcsr_GetMaxBusinessDate;
        FETCH lcsr_GetMaxBusinessDate INTO ldt_Filter;
        CLOSE lcsr_GetMaxBusinessDate;
        ldt_Filter := ( Trunc( ldt_Filter ) - 3 );
        APEX_UTIL.IR_FILTER( p_page_id       => :APP_PAGE_ID,
                             p_report_column => 'BUSINESS_DATE',
                             p_operator_abbr =>'GTE',
                             p_filter_value  => TO_CHAR( ldt_Filter, 'YYYYMMDDHH24MISS' ) );
    END;Can anyone tell me:
    1. How to set this filter programmatically (also needs to be displayed on the page so the user can see the current filter...as if it were created via the GUI) ***OR***
    2. Some other work around for this issue..
    Thanks,
    -Joe

    Actually, now that I look further, I don't think it is going to work to simply set the filter programmatically. The end user can still click the column heading where they are only given the choice of the LOCALTIMESTAMP based filters. If they pick one, the page is going to be out to lunch for them.
    We really need some other fix. We really need a way to actually address the underlying issue.
    -Joe

  • Book layout question due to lack of functionality in InDesign

    I am a doctoral student (cancer cell biology) starting to write my dissertation (in Word 2007) and I'm using InDesign CS3 (5.0.4) for the layout (I refuse to layout figures and tables in Word... tried it... giant pain in the a$$).  My original plan was to create a Book in InDesign and have each chapter be a separate file.  Due to the bibliography software I need to use the Word file has to be a single file (see this thread for details).  InDesign cannot just Place a range of pages (it's seems to be all or nothing) and this creates a problem (see the previous thread).
    The question I have, is it smart to break each chapter out into a separate file?  My thinking was that since I would be bringing in a fair number Photoshop and Illustrator files into each chapter it would be wise to keep the file size down (I'm not doing this on the best of computers, at least by graphic designer standards) and it would make rearranging a little easier (my mentor has a habit of changing his mind and chapter 3 could easily switch places with chapter 7).
    This is my first book so any thoughts or advice you have would be greatly appreciated.
    Regards,
    Adrian.

    Nah, it's just me.  My mentor wants paper output for the markup, the committee will take a PDF or paper and the university has (thankfully) instituted an electronic submission criteria.  The final product has to be a PDF to the school and I'll have some output to paper and bound for my mentor, my family (as a gift) and myself.
    The two students before me did everything in Word and yeah you can make Word do it but I just don't hassle with it.  I make religious use of styles in Word (and only 4 styles at that... talked to a graphic designer who does books for a living "Keep the styles to minimum!!"... Done), so getting it into InDesign is cake.  Also, my mentor has a nasty of habit of constantly changing his mind and doing things like, "Can you move that picture about a centimeter to left, I just want a little space in there".  I have been through this with Word, it will do it but the voices in your head will start suggesting that you kill again (and nobody wants that).  I plan on doing my grants this way, manuscripts this way, everything.  Everybody (NIH, journals, other funding sources) requires a PDF now and some require rather optimized PDFs (people think I'm crazy but I swear there is a difference between the PDFs that InDesign outputs and the ones that my wife's Mac does--just using the built-in PDF renderer or some of the other PDF creators for Windows), so I just went ahead and went through a tutorial on VTC.com and then read a couple of books.  I wouldn't be able to layout a magazine but I can do grants, manuscripts, dissertations.

Maybe you are looking for

  • Printing from Classic

    I can no longer print from Classic (v 9.2)but printing from OS 10.1.5 is fine. Printing from Classic was not a problem until I tried to network my G4 with a PC. After several attempts, changing settings (airport, ethernet etc)I gave up and reset for

  • USER_DATASTORE: Could DBMS_LOB be leaking memory?

    We've got a database which is indexed with USER_DATASTORE and the following procedure. We're getting an occasional situation where this message appears in the alert log: ORA-04030: out of process memory when trying to allocate 8716 bytes (pga heap,Ge

  • Problem deploying Software InstallationGPO in AGPM 4

    I can create a controlled GPO, Check Out, edit, create a software installation GPO, and CheckIN, When I attempt to Deploy or Check out a second time to edit the GPO I receive the following error: Check Out GPO: Test Application GPO...Failed The overa

  • My iPhone 4 is frozen on a green/black screen and refuses to do anything!!

    So I was charging my iPhone 4 on my computer, and I was transferring some concert videos from my iPhone to my cmoputer to create space. Anyway, about half way through the process of pasting my video's to my computer folder, my iPhone decided to 'time

  • Just let me sync my **** ipad mini and get on with my life

    i just got the new ipad mini and it will not sync to my dell laptop and at the top it say "not charging. i can't even use it.