APEX_UTIL.URL_ENCODE

Hi oraclers,
Am I missing something obvious here? (Missing update, known egregious bug etc... )
select *
from   apex_release
VERSION_NO     API_COMPATIBILITY     PATCH_APPLIED
4.0.0.00.46     2010.05.13     ---------------------------------------------------------------------------------------
with o as ( select '{}' original
            from   dual )
select o.original,
       apex_util.url_encode( o.original )                     apex_encoded,
       utl_url.escape( o.original )                           utl_escaped,
       utl_url.unescape( utl_url.escape( o.original ) )       utl_roundtrip,
       utl_url.unescape( apex_util.url_encode( o.original ) ) apex_utl_roundtrip
from o      
ORIGINAL     APEX_ENCODED     UTL_ESCAPED     UTL_ROUNDTRIP     APEX_UTL_ROUNDTRIP
{}             %7D%7B             %7B%7D             {}             }{Something is not right here....
Regards,
rhodry

A: APEX_UTIL.URL_ENCODE

Hi rhodry,
i think you got a mixup of functions in your example.
APEX_UTIL and UTL_URL use similiar but different encoding mechanisms. Therefore you cannot decode with UTL_URL when you encode with APEX_UTIL.
I changed you SELECT and executed it on apex.oracle.com
with o as ( select '{}' original
            from   dual )
select o.original,
       apex_util.url_encode( o.original )                     apex_encoded,
       utl_url.escape( o.original )                           utl_escaped,
       utl_url.unescape( utl_url.escape( o.original ) )       utl_roundtrip,
       WWV_FLOW_UTILITIES.url_decode2( WWV_FLOW_UTILITIES.url_encode2( o.original ) ) apex_utl_roundtrip
from o
ORIGINAL     APEX_ENCODED     UTL_ESCAPED     UTL_ROUNDTRIP     APEX_UTL_ROUNDTRIP
{}     %7D%7B     %7B%7D     {}     {}brgds,
Peter
Blog: http://www.oracle-and-apex.com
ApexLib: http://apexlib.oracleapex.info
BuilderPlugin: http://builderplugin.oracleapex.info
Work: http://www.click-click.at

Hi rhodry,
i think you got a mixup of functions in your example.
APEX_UTIL and UTL_URL use similiar but different encoding mechanisms. Therefore you cannot decode with UTL_URL when you encode with APEX_UTIL.
I changed you SELECT and executed it on apex.oracle.com
with o as ( select '{}' original
            from   dual )
select o.original,
       apex_util.url_encode( o.original )                     apex_encoded,
       utl_url.escape( o.original )                           utl_escaped,
       utl_url.unescape( utl_url.escape( o.original ) )       utl_roundtrip,
       WWV_FLOW_UTILITIES.url_decode2( WWV_FLOW_UTILITIES.url_encode2( o.original ) ) apex_utl_roundtrip
from o
ORIGINAL     APEX_ENCODED     UTL_ESCAPED     UTL_ROUNDTRIP     APEX_UTL_ROUNDTRIP
{}     %7D%7B     %7B%7D     {}     {}brgds,
Peter
Blog: http://www.oracle-and-apex.com
ApexLib: http://apexlib.oracleapex.info
BuilderPlugin: http://builderplugin.oracleapex.info
Work: http://www.click-click.at

Similar Messages

  • URL_ENCODE

    am i doing something wrong.
    i keep getting an error when i try this
    select client_name, APEX_UTIL.URL_ENCODE(client_abbr) client_abbr
    from clients
    order by client_name
    i am using this query to populate a LOV. here is the error.
    * LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.
    any help would be great
    thanks

    Please try like
    select eno d,ename r
    from emp
    order by eno.
    d is for display value and r is for return value. Hope it works.
    Good luck.
    Suma.

  • Redirecting an item value to another page..

    Hi,
    I am trying to auto-populate couple of values on page 2 when I click a button on page 1. Tried setting the item values using the comma separated list and also by re-directing to an url. Hit an issue when the values that need to be set itself contain a comma within itself. Could you let me know if there is any other de-limiter that I can use instead of a comma while setting the item values.
    For instance:
    There is a button on Page 58. When this button is clicked, I should be redirected to page 45 in the application and the values in P58_Name and P58_LocId should be auto-populated in P45_Name and P_45LocId.
    Only when there is NO comma in value of P58_Name, this works fine. But, when there is a comma in P58_Name this is what happens:
    P58_Name = Mickey, Mouse
    P58_LocId = 145
    Once the button is clicked on page 58, the fields in page 45 are auto-populated as below:
    P45_Name = Mickey
    P45_LocId = Mouse
    Will there be a way to use a different de-limiter in the comma separated list? Kindly help.
    Thanks,
    P

    the trouble is that the comma in the item name messes up with Apex URL structure, since it uses a comma separated list of item names and values..
    You can set another item with the escaped value of the item in Javascript using the escape function(builtin)
    escape( $v('ITEM_NAME'))or in PSLQL using APEX_UTIL.URL_ENCODE or HTF.encode functions
    and then refer that new item in the Branch instead of the old one one(with commas)

  • Use apex_application.g_unrecoverable_error := TRUE; and apex_collection.truncate_collection doesn't work

    I'm trying to print pdf using JasperReports Integration. I need to do an INSERT then clean all the page items(including the apex_collection.truncate_collection for truncate the collection)  and print with the Jasper call(all in one button).
    The Insert works, and i can perfectlly print too, but the clean page items and the truncate collection doesn't.
    Please HELP! its really urgent!!
    Thnx.
    Ricardo Capuz

    Hi Nicolette, i'm really new on Apex, sorry for the bad explanation.
    First, thank for your answer, my apex version is 4.2.2.
    I'm sure that the insert works perfect, cause i checked with the database.
    i used apex_application.g_unrecoverable_error := true; because is the code that bring the people of JasperReportsIntegration and I tried to comment it but without it, the print doesn't work.
    My problem is when I use the g_unrecoverable_error the printPDF works perfect but apex does not truncate the collection or clean the fields neither.
    I have an invoicing application, i want to click on "generate invoice" and do the insert, print pdf and refresh the page, so that when the user finish to print the invoice, the invoicing application is clean for make another invoice.
    Here's the code of the print pdf....
    DECLARE
               l_blob        BLOB;
               l_mime_type   VARCHAR2 (100 char);
               l_proc varchar2(100) := 'get report as blob, then show';
               l_additional_parameters varchar2(32767);
    BEGIN
          l_additional_parameters := 'USUARIO_CODIGO=' || apex_util.url_encode(:APP_USER);
          l_additional_parameters := l_additional_parameters||'&PRESUPUESTO_NUMERO='||apex_util.url_encode(:PRESUPUESTO_ID);
          xlog (l_proc, 'url (orig):' || 'http://Servidor-New:8181/JasperReportsIntegration/report');
       -- generate the report and return in BLOB
      xlib_jasperreports.set_report_url ('http://Servidor-New:8181/JasperReportsIntegration/report');
      xlib_jasperreports.get_report(
                                       p_rep_name => '&JASPER_HOME./PRESUPUESTO_CNO',
                                       p_rep_format => 'pdf',
                                       p_data_source => '&JASPER_HOME.',
                                       p_rep_locale => 'es_ES',
                                       p_additional_params => l_additional_parameters,
                                       p_out_blob            => l_blob,
                                       p_out_mime_type       => l_mime_type
       -- set mime header and filename
       OWA_UTIL.mime_header (ccontent_type      => l_mime_type,
                             bclose_header      => TRUE);
       -- send Content-Disposition and suggest a file name for saving
       htp.p('Content-Disposition: attachment; filename="'|| 'Presupuesto.pdf' ||'"');
       -- set content length
       HTP.p ('Content-length: ' || DBMS_LOB.getlength (l_blob));
       OWA_UTIL.http_header_close;
       -- download the file and display in browser
       WPG_DOCLOAD.download_file (l_blob);
       -- release resources
       DBMS_LOB.freetemporary (l_blob);
       -- stop rendering of APEX page
      apex_application.g_unrecoverable_error := TRUE;
    /* apex_application.stop_apex_engine;                               -------I PROVE WITH THIS ONE AND IT DOESN'T WORK
       apex_util.redirect_url (                                      --------IF I SET THE BUFFER RESET TO TRUE, IT CLEAN THE FIELDS BUT DON'T PRINT AND IF I SET TO FALSE IT PRINT BUT DON'T CLEAN THE FIELDS.
    p_url => 'f?p=&APP_ID.:30:' || :SESSION,
                              p_reset_htp_buffer => true ); */
        -- Limpieza de ITEMS collection
    apex_collection.truncate_collection(p_collection_name => 'ITEMS');  -----I TRIED TO PUT THIS PART UPPER THAN THE g_unrecoverable_erro BUT IS THE SAME THING.
    :P30_CI:='';
    :P30_NOMB_AP_PACIENTE:=' ';
    :P30_HISTORIA_PACIENTE:= NULL;
    :P30_RIF_RESP_PAGO:=' ';
    :P30_NOMBRE_RESP_PAGO:=' ';
    EXCEPTION
       WHEN OTHERS
       THEN
          xlog (l_proc, SQLERRM, 'ERROR');
          RAISE;
    END;
    I really aprecciate your help. Thank you Nicolette!!!
    Ricardo Capuz

  • How to get digital signature for Google Map geocoding V3 in PL/SQL?

    Hi, Gurus:
        Could anyone provide me an example about how to generate digital signature for Google Maps service v3 in PL/SQL? We tried to upgrade our program using Google maps service from v2 to v3. We are using PL/SQl on background to send request to Google for geocoding. We found some sample code to register with digital signature, but none of them is based on PL/SQl. Notice I used Google business client ID "gme-XXX" and wallet.
    https://developers.google.com/maps/documentation/business/webservices/auth#digital_signatures
    Google Maps API - more URL signing samples
    Here is my code for V2. I notice in order to get signature, I need to use HMAC-SHA1 algorithm.
    procedure Get_Geocoding(P_s_Address in varchar2, P_s_Geocoding out varchar2, P_n_accuracy out number, P_b_success out boolean) is
      l_address varchar2(4000);
      l_url varchar2(32000);
      l_response varchar2(3200);
      n_first_comma number;
      n_second_comma number;
      n_level_length number;
    BEGIN
      /* TODO implementation required */
      l_address:=APEX_UTIL.URL_ENCODE(P_s_Address);
      l_address := replace(l_address,' ','+');
      l_url := 'http://maps.google.com/maps/geo?q='||l_address||'&'||'output=csv'||'&'||'client=gme-XXX';
    l_response := utl_http.request(l_url, APEX_APPLICATION.G_PROXY_SERVER, '/u02/app/oracle/admin/apexsb/wallet', 'XXXXXXXX');
      n_level_length:=0;
      n_first_comma:=instr(l_response,',',1,1);
      n_second_comma:=instr(l_response,',',1,2);
      n_level_length:=n_second_comma-n_first_comma-1;
      P_n_accuracy:=0;
      if n_level_length>0 then
      P_n_accuracy:=to_number(substr(l_response,n_first_comma+1, n_level_length));
      end if;
      l_response:=substr(l_response,instr(l_response,',',1,2)+1);
      --dbms_output.put_line('In function: l_response ='||l_response);
      P_s_Geocoding:=l_response;
      if (P_s_Geocoding<>'0,0') then
      P_b_success:=true;
      --dbms_output.put_line('true');
      else
      P_b_success:=false;
      --dbms_output.put_line('false');
      end if;
    END;
    Thanks!

    Hi, guys:
        I tried to generate digital signature for Google map service
         Maps for Business: Generating Valid Signatures - YouTube
        Generating an HMAC-SHA-1 Signature Using Only PL/SQL
          OAuth and the PL/SQL | Data Warehouse in the Cloud
       but I got error message from Google:
    Unable to authenticate the request. Provided 'signature' is not valid for the provided client ID. Learn more: https://developers.google.com/maps/documentation/business/webservices/auth
       I think there is something wrong with my code to generate signature, as if I remove the part regarding client and signature, it will work, can anyone help me on this problem?
    /*Procedure Get_Geocoding is used to get geocoding with accuracy level for V3 business account, you can find Google map digital signature descrirption from
    https://developers.google.com/maps/documentation/business/webservices/auth#digital_signatures
    if geocoding is 0,0, procedure returns false to indicate failure of get geocoding*/
    procedure Get_Geocoding2(P_s_Address in varchar2, P_s_Geocoding out varchar2, P_n_accuracy out number, P_b_success out boolean) is
      --private key for Google business account, this is provided by Google with client name.
      l_private_key_src varchar2(200):='xxxxxxxxxxxxxxxxxxx';
      l_private_key_b64_alter varchar2(200):= translate(l_private_key_src,'-_','+/');
      l_private_key_bin raw(2000);
      l_client_name varchar2(100):='gme-xxx';
      l_signature_mac raw(2000);
      l_signature_b64 varchar2(200);
      l_signature_b64_alter_back varchar2(200);
      l_Google_service_domain varchar2(200):='http://maps.googleapis.com';
      l_address varchar2(4000);
      l_url varchar2(32000);
      l_path varchar2(32000);
      l_response varchar2(32000);
      l_page UTL_HTTP.HTML_PIECES;
      n_actual_length number;
      json_obj json;
      json_tempobj json;
      jl_listOfValues json_list;
      json_geom_obj json;
      json_loc json;
      l_lat  VARCHAR2(40);
      l_lng  VARCHAR2(40);
      l_status VARCHAR2(255);
      json_accuracy json;
      --temp_string varchar2(10000);
      n_first_comma number;
      n_second_comma number;
      n_level_length number;
      BEGIN
    /* TODO implementation required */
    l_private_key_bin := utl_encode.base64_decode(UTL_I18N.string_to_raw(l_private_key_b64_alter, 'AL32UTF8'));
    l_address:=APEX_UTIL.URL_ENCODE(P_s_Address);
    --dbms_output.put_line(l_address);
    l_address := replace(l_address,' ','+');
    l_path := '/maps/api/geocode/json?address='||l_address||'&'||'sensor=true';
    dbms_output.put_line(l_path);
    l_signature_mac :=DBMS_CRYPTO.mac(UTL_I18N.string_to_raw(l_path, 'AL32UTF8'), DBMS_CRYPTO.hmac_sh1,l_private_key_bin);
    l_signature_b64:= UTL_RAW.cast_to_varchar2(UTL_ENCODE.base64_encode(l_signature_mac));
    l_signature_b64_alter_back:=translate(l_signature_b64,'+/','-_');
    dbms_output.put_line(l_signature_b64_alter_back);
    --get response from Google map service
    l_url:=l_Google_service_domain||l_path||'&client='||l_client_name||'&signature='||l_signature_b64_alter_back;
    --l_url:=l_Google_service_domain||l_path;
    dbms_output.put_line(l_url);
    l_page:=utl_http.request_pieces( l_url, 99999);
    for i in 1..l_page.count loop
    l_response:=l_response||l_page(i);
    end loop;
    n_actual_length:=length(l_response);
    dbms_output.put_line(n_actual_length);
    dbms_output.put_line(l_response);
    --parse JSON result
    json_obj:=new json(l_response);
    l_status := json_ext.get_string(json_obj, 'status');
    IF l_status = 'OK' then
    jl_listOfValues := json_list(json_obj.get('results'));
    json_tempobj := json(jl_listOfValues.get(1));
    json_geom_obj := json(json_tempobj.get(3));
    json_loc := json_ext.get_json(json_geom_obj, 'location');
    l_lat := to_char(json_ext.get_number(json_loc, 'lat'));
    l_lng := to_char(json_ext.get_number(json_loc, 'lng'));
    P_s_Geocoding:=l_lat||','||l_lng;
    dbms_output.put_line('##########'||P_s_Geocoding);
    case json_ext.get_string(json_geom_obj, 'location_type')
    when 'ROOFTOP' then P_n_accuracy:=9;
    when 'RANGE_INTERPOLATED' then P_n_accuracy:=7;
    when 'GEOMETRIC_CENTER' then P_n_accuracy:=5;
    else P_n_accuracy:=3;
    end case;
    P_b_success:=true;
    else
    P_b_success:=false;
    P_n_accuracy:=0;
    P_s_Geocoding:='0,0';
    end if;
      END;

  • [svn] 4595: Fix for - Example code in ObjectProxy ASDoc page is incorrect

    Revision: 4595
    Author: [email protected]
    Date: 2009-01-20 08:11:25 -0800 (Tue, 20 Jan 2009)
    Log Message:
    Fix for - Example code in ObjectProxy ASDoc page is incorrect
    Also modify the build.xml for "ant asdoc"
    QE Notes: None
    Doc Notes: None
    Bugs: SDK-18335
    tests: checkintests
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-18335
    Modified Paths:
    flex/sdk/trunk/asdoc/build.xml
    flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/ObjectProxy.as

    >
    build url like this,
    '<a href=f?p='||NV('APP_ID')||':45:'||V('APP_SESSION')||'::NO:RP,45,CIR:ub_branch,ub_supplier,ub_customer,ub_product,ub_aging,ub_destination:'||REPLACE(branch,' ','%20')||'%2C'||REPLACE(ub_supplier,' ','%20')||'%2C'||REPLACE(ub_customer,' ','%20')||'%2C'||REPLACE(ub_product,' ','%20')||'%2C'||REPLACE(ub_aging,' ','%20')||'%2C'||REPLACE(ub_destination,' ','%20') ||'>All</a>',All of this is handled by the apex_util.url_encode API function as described above.
    However, as also mentioned above, the best approach is to only pass discrete key values in URLs.

  • Encoding for blank spaces in url in a sql statement in report

    1. What function or process do I use to encode for blank spaces in a url link in a report?
    I need to link from a report to a 2nd report and pass 5 variables. I believe that I need to do that by embedding my own url in the sql for the report, since the standard report sets up for only 3 variables to be passed.
    One of my variables PARTNER_FIRM has spaces in it, so how do I encode for that in the query. Currently, I have the following (... simplified).
    select partner_firm,
    count(distinct event) distinct_events,
    '<a href="f?p=18509:4:&SESSION.::NO:4:P4_PARTNER_FIRM,P4_QUARTER,P4_CATEGORY,P4_PRODUCT_CATEGORY,P4_EVENT:' ||
    partner_firm ||
    '%2C&P3_QUARTER.%2C&P3_CATEGORY.%2C&P3_PRODUCT_CATEGORY.%2C&P3_EVENT.">' ||
    count(distinct lower(attendee_email)) || '</a>' distinct_attendees
    from all_events ...
    but partner_firm has spaces which are returned. I think there is some way that I can encode for that?
    Thanks,
    Stephen

    Sure there is:
    select apex_util.url_encode('http://ww.oracle.com/') from dual
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • Redirect to another page and set the error or success message from process

    I have a process that runs when a page is submitted. In the process I am catching an exception and if an exception occurs I want to redirect to a different page and display the error message of the exception. How can this be done?
    Below is my code. The redirect works but I want to set an error message to display on page 765 which is a different page to the one with this process on.
    begin
        -- some code here
    exception when others then
        owa_util.redirect_url('f?p=&APP_ID.:765:&SESSION.::NO:::');
    end;

    >
    Please update your forum profile with a real handle instead of "973239".
    I have a process that runs when a page is submitted. In the process I am catching an exception and if an exception occurs I want to redirect to a different page and display the error message of the exception. How can this be done?
    Below is my code. The redirect works but I want to set an error message to display on page 765 which is a different page to the one with this process on.
    begin
    -- some code here
    exception when others then
    owa_util.redirect_url('f?p=&APP_ID.:765:&SESSION.::NO:::');
    end;
    Use the <tt>f</tt> function's <tt>notification_msg</tt> parameter to pass the error message in the URL:
      owa_util.redirect_url('f?p=&APP_ID.:765:&SESSION.::NO:::&notification_msg=' || apex_util.url_encode(l_error_msg)); 
    When you have a problem you'll get a faster, more effective response 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) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)

  • Disable html escaping mode - Basic

    4.2.1
    Hi,
    Our application runs within our network and hence no security worries as such. It's also not a critical application.
    In 4.2.1, there is the html escaping mode with only two options basic and extended. Even with Basic it escapes & < and >. IS there a way to disable that? We have parameter passing where some items have & in their names. and they seem to be getting skipped.
    I pass parameters when user clicks on a link in a report(using standard link features) which creates the URL. But looks like the names which have & have those removed.
    Thanks,
    Ryan

    ryansun wrote:
    4.2.1
    Our application runs within our network and hence no security worries as such. It's also not a critical application.
    In 4.2.1, there is the html escaping mode with only two options basic and extended. Even with Basic it escapes & < and >. IS there a way to disable that?No. It's required by the HTML specification.
    We have parameter passing where some items have & in their names. and they seem to be getting skipped.
    I pass parameters when user clicks on a link in a report(using standard link features) which creates the URL. But looks like the names which have & have those removed.As '&' is a URL-reserved character it must be encoded in order to be passed in a URL parameter, for example using the <tt>apex_util.url_encode</tt> API.
    As has been recommended before, the simple way to avoid problems in this area is not to pass string data values as URL parameters. Pass simple numeric or alphanumeric key values, and use these to retrieve additional information using computations and processes on the target page.

  • Cannot encode double & single quote " and ' using htmldb_util.url_encode()

    Hello,
    I'm using HTMLDB 1.5.0.00.33 on Oracle 9.2.0.6 database. The data(a sql query that populates the report page) that I want to pass as part of URL string contains special characters like #, $, % and quotes " or '. I'm using htmldb_util.url_encode() to encode the data and it works fine for special characters except for " & '. Can someone please help in this? Below sql query shows that.
    SQL>select htmldb_util.url_encode('A%"#') from dual;
    HTMLDB_UTIL.URL_ENCODE('A%"#')
    A%25"%23
    1 row selected.
    Thanks
    Shashin

    Shashin,
    You could try using the UTL_URL.Escape function with the escape_reserved_chars parameter set to TRUE. That should encode the reserved characters.
    See the documentation here: http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_url.htm#sthref15935
    If you want to call it from a SQL statement, you'll need to wrap it in a function like this:
    function MyURLEscape(URL varchar2) return varchar2 is
       Result varchar2(4000);
    begin
       Result := UTL_URL.Escape(URL, TRUE);
       return(Result);
    end MyURLEscape;

  • 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

  • APEX_UTIL.EDIT_USER Procedure do not work correctly in APEX 4.0.2.00.07

    Hi,
    I created user in Apex system without privileges.
    Next I want to provision privileges using APEX_UTIL.EDIT_USER Procedure.
    But when I try to set p_developer_roles param to ADMIN:CREATE:DATA_LOADER:EDIT:HELP:MONITOR:SQL in web interface of apex I see the next values: User is workspace administrator - yes; User is a developer - yes; other privilege attributes are NO! When I login I can access to Application Builder but not to SQL Workshop.
    In short if i try to provision any developers privileges changes not appearing in web interface, but also i can access to Application Builder if I have that privilege. When I provision SQL:MONITOR:DATA_LOADER privilege I also see:
    User is workspace administrator - no; User is a developer - yes; other privilege attributes are NO and I can't access to SQL Workshop!
    APEX_UTIL.CREATE_USER Procedure with same values for p_developer_privs param work fine...
    Help me to resolve this issue.

    Please, help

  • Making apex_util.get_print_document return an error message

    We are using apex_util.get_print_document in a process to run a report something like this:
    declare
       l_report blob := null;
    begin
        l_report := apex_util.get_print_document (
            p_application_id      => :APP_ID,
            p_report_query_name   => 'report_query_name',
            p_report_layout_name  => 'report_layout_name',
            p_report_layout_type  => 'rtf',
            p_document_format     => 'rtf'
       if l_report is not null and dbms_lob.getlength(l_report) > 0 then
          apex_application.g_print_success_message := 'Report Created.<br>';       
          INSERT INTO reports (attachment, date_created, filename, mime_type)
          VALUES (l_report, sysdate, 'report.rtf', 'text/rtf' );       
       else       
          apex_application.g_print_success_message := '<span style="color:#CC0000">There was a problem creating the report.</span><br>';   
       end if; 
    end;And this works well most of the time. The problem is, if the report fails for some reason, apex_util.get_print_document gives no information whatsoever as to what went wrong. Is there any way at all we can find out what the problem was?
    Application Express 4.0.2.00.07
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    Hi,
    add exception to your code.
    declare
       l_report blob := null;
    begin
        l_report := apex_util.get_print_document (
            p_application_id      => :APP_ID,
            p_report_query_name   => 'report_query_name',
            p_report_layout_name  => 'report_layout_name',
            p_report_layout_type  => 'rtf',
            p_document_format     => 'rtf'
       if l_report is not null and dbms_lob.getlength(l_report) > 0 then
          apex_application.g_print_success_message := 'Report Created.<br>';       
          INSERT INTO reports (attachment, date_created, filename, mime_type)
          VALUES (l_report, sysdate, 'report.rtf', 'text/rtf' );       
       else       
          apex_application.g_print_success_message := '<span style="color:#CC0000">There was a problem creating the report.</span><br>';   
       end if; 
    EXCEPTION
       WHEN OTHERS THEN
          raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
    end;This will give proper error message.
    Hope this will helps you.
    Regards,
    Jitendra

  • APEX_UTIL.GET_PRINT_DOCUMENT Error Unable to get the document

    Hi,
       I am working on Oracle APEX 4.1 to send the report as an attachment through mail  I am unable to get the document while calling the APEX_UTIL.get_print_document. I have created a report query and report template (rtf template) so as to send the report as an email attachment. The report works fine individually upon clicking of button so there is no issue in BI publisher configuration. I am sure there is something very trivial which I am missing out here. Any help will be appreciated.
    Declare
       l_id number;
       l_document BLOB;
       l_error_msg varchar2(2000);
    BEGIN
       l_document := APEX_UTIL.GET_PRINT_DOCUMENT
             p_application_id=>'123',
             p_report_query_name=>'Sample_Report',   
             p_report_layout_name=> 'Sample_Report',
             p_report_layout_type=>'RTF',
             p_document_format=>'PDF',
             p_print_server => 'f?p=&APP_ID.:0:&SESSION.:PRINT_REPORT=Sample_Report'
       IF l_document is null
       THEN
           dbms_output.put_line( ' no report returned');
          l_error_msg:='<html> <body> <h1 > Apologies the report was not returned from the apex , as there is some printing issues </h1> </body> </html> ';
       ELSE
          l_error_msg:=null;
       END IF;
       IF l_error_msg IS NULL THEN
           l_id := APEX_MAIL.SEND(
           p_to => '[email protected]',
           p_from => '[email protected]',
           p_subj => 'APEX_MAIL with attachment',
           p_body => 'Please review the attachment.',
           p_body_html => '<b>Please</b> review the attachment' || l_error_msg);
          dbms_output.put_line(l_id);
          IF l_document is not null then
             APEX_MAIL.ADD_ATTACHMENT (
                        p_mail_id => l_id,
                        p_attachment => l_document,
                        p_filename => 'Sample_Report.pdf',
                        p_mime_type => 'application/pdf');
          END IF;
    END IF;
    END;
    Here the output says no report returned.
    Thanks & Regards
    Ahmed

    Try removing the parameter p_print_server from the call.  This will use your default print server which should already be configured to use the BI Publisher engine.

  • Apex_util.get_blob was not found on this server

    Hi All,
    APEX Version: 3.1.1.00.09
    Database version 11g
    I am trying to create a report, with a column having a link to download the file stored as BLOB type in the database.
    I performed the following steps:
    *1. created custom report base on SQL Query:*
    select PROGRAM_ID ,
    USER_ID ,
    dbms_lob.getlength(FILE_CONTENT) "FILE_CONTENT" ,
    File_name
    from PGMRECRT_FRMS_USRSUBMTSTATUS
    [Primary Keys for the table PGMRECRT_FRMS_USRSUBMTSTATUS are :  Program_id and user_id]
    *2. Configured BLOB Download Format Mask for the column "File_Content" as:*
    DOWNLOAD:PGMRECRT_FRMS_USRSUBMTSTATUS:FILE_CONTENT:PROGRAM_ID:USER_ID::FILE_NAME:LST_UPD_TSTMP::attachment:Download
    *3. When I run the report I get the Download link in the "File_Content" column.*
    *4. When the link is clicked it throws 404 Not found Error, with the following message on the browser:*
    The requested URL /pls/apex/apex_util.get_blob was not found on this server.
    The Page Source contains the following
    href="apex_util.get_blob?s=3261371303066053&a=101&c=2878703203169482&p=16&k1=147&k2=&ck=01786319873F8A6F1A1344A1B2A17567&rt=CR" alt="Download" title="Download 32KB"
    I don't see the second Primary key being passed in the source. (User_id)
    I checked the HTTP Server error log, here is the error recorded in the log file:
    [Sat Jun  6 02:22:14 2009] [error] [client 141.144.160.57] [ecid: 1244280134:148.87.1.123:18724:0:2223,0] mod_plsql: /pls/apex/apex_util.get_blob HTTP-404 ORA-00900: invalid SQL statement\nORA-06512: at "SYS.WWV_DBMS_SQL", line 206\nORA-06512: at "FLOWS_030100.WWV_FLOW_DML", line 2409\nORA-06512: at "FLOWS_030100.HTMLDB_UTIL", line 1580\nORA-06512: at line 31\n
    Please suggest what is the problem here and how should I go about resolving it.
    I have created sample report: Visit following link: [It is SSO enabled]
    https://techbpo-stage.oracle.com:4443/pls/apex/f?p=101:16
    Thanks & Regards
    Pooja

    For people who are still searching for a solution:
    I think you have to make sure that you select the primary key of the table containing the blob and do not use an alias for this column.
    I first tried following scenario:
    select my_table.pk_id, my_table.description, dbms_lob.getlength(doc.document_data) document_data
    from table1 my_table
    join table2 doc
    on doc.pk_id = my_table.fk_doc_id;
    I filled in the correct column attributes but still this resulted in the 500 error.
    After some research i tried following scenario:
    select my_table.pk_id, my_table.description, doc.pk_id document_id, dbms_lob.getlength(doc.document_data) document_data
    from table1 my_table
    join table2 doc
    on doc.pk_id = my_table.fk_doc_id;
    But still this resulted in the 500 error.
    Finally thanks to a lucky guess I removed the alias from the doc.pk_id and added an alias for the my_table.pk_id and everything worked fine.
    select my_table.pk_id table_id, my_table.description, doc.pk_id, dbms_lob.getlength(doc.document_data) document_data
    from table1 my_table
    join table2 doc
    on doc.pk_id = my_table.fk_doc_id;
    I also read something about the order in which you select the blob file, I always select it as the last column. I'm not sure if this has any influence on the result.
    Regards,
    Bjorn

Maybe you are looking for

  • How do you set repeat events for a given day of the week

    How do you set a repeat event in calender for a given day of the month.  Expample 3rd Wednesday each month?

  • APD timeout issue in execution

    Good afternoon, Please anybody knows about this issue? the problem description is the following: We have an APD in a Process Chain, this chain was running well in previous dates, but when we run it yesterday and a issue happened. The message that app

  • Connect a 6280 to a palm t3

    Hi, I have unsuccessfully been trying to connect my brand new 6280 to my tungsten t3 palm via bluetooth The phonelink application does not recognize this model... Would you have a hint? Do you know which initialization string to use? Thanks in advanc

  • Apps not showing correct version

    hello masters, i would like to know how to check exact version of oracle applications R12. i have applied patch delta6 and RUP6 but don't know it is applied or not......how can i check that patch is applied successfully??? when i query SQL> select pr

  • Creative MuVo TX FM prob

    i have a problem with my creative muvo tx fm.i have full battery and i turn off my mp3 player.then i dont use it for 2-3 months.the next time i turn it on my battery is all out even though i didnt use it!im sure it doesnt turn on by accident or anyth