Redirect to URL from PL/SQL

Hi,
I'm trying to redirect to a url from an Application Process using
DECLARE
l_url varchar2(2000);
BEGIN
select APEX_UTIL.PREPARE_URL('f?p=&APP_ID.:10:&SESSION.:DELETELINE:&DEBUG.:RP:P10_ORID,P10_ORDID:&P10_ORID.,&PP10_CCODE.') into l_url from dual;
htp.init();
owa_util.redirect_url(l_url, true);
END;The above process is called with javascirpt using ajax. This successfully deletes the item i want but first it returns this error
(<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> and second it doesn't refresh the page.
I'm using prepare_url since Page Protection is enabled with Arguments Must Have Checksum.

Solutions:
i) Use the Javascript inside the Pl Sql .,
sample Code:
declare
l_count number:=0;
begin
select count(*) into l_count from usermaster where usertypeid in
( select usertypeid from usermaster where usertypeid !=1 and Userid=:P9_USERID);
if l_count > 0 then
return true;
else
htp.p('<script language="javascript">');
htp.p('window.location ="http://localhost:8080/apex/f?p=2234:8:&SESSION.::NO::"');
htp.p('</script>');
return false;
end if;
end
that's all
All the best...
Udayakumar
Edited by: 872464 on Sep 29, 2011 5:59 AM

Similar Messages

  • Redirect Parent URL from within iframe

    Hi - I have an iframe that contains a series of links ... and
    when the user clicks on one of the links within the iframe, I want
    the parent page's URL to be redirected to a particular URL.
    Right now, if I just use the standard <a href="target
    URL">Text</a> for the link, it brings up the redirect JUST
    INSIDE the iframe ... but I want the
    parent page that contains the iframe to change to the target
    URL.
    It is like I need to embed the statement:
    <script language='Javascript' type='text/Javascript'>
    window.location = "target URL";
    </script>
    inside the link - but I am not sure of the best or most
    proper way to do that.
    Any suggestions? [I tried to do a SEARCH on my subject topic,
    and it generates some odd forum error message.] Thanks!

    MLBdesigner wrote:
    > Hi - I have an iframe that contains a series of links
    ... and when the user
    > clicks on one of the links within the iframe, I want the
    parent page's URL to
    > be redirected to a particular URL.
    >
    > Right now, if I just use the standard <a href="target
    URL">Text</a> for the
    > link, it brings up the redirect JUST INSIDE the iframe
    ... but I want the
    >
    parent page that contains the iframe to change to the target
    URL.
    >
    > It is like I need to embed the statement:
    > ************
    > <script language='Javascript'
    type='text/Javascript'>
    > window.location = "target URL";
    > </script>
    > ************
    > inside the link - but I am not sure of the best or most
    proper way to do that.
    >
    > Any suggestions? [I tried to do a SEARCH on my subject
    topic, and it
    > generates some odd forum error message.] Thanks!
    >
    Remember the "same origin policy", which means you can use js
    only to
    manipulate data from the same origin (same server).
    Mick

  • Get current URL from PL/SQL Package in Portal

    Hello, anyone knows the magic code to get the URL of current Web page from a package running from inside the same page?
    Thx

    You can use the page_url field of the portlet runtime record.

  • Send a report to report server from PL/SQL Procedure

    Hi Report Gurus,
    Please can I know how to run a report from pl/sql stored procedure. Is there any way to execute URL from PL/SQL?
    Thanks,
    Simi.

    Why, yes there is!
    If you're talking about PL/SQL stored in the database, check the function UTL_HTTP.REQUEST. A "describe utl_http" in SQL*Plus will do the trick.
    But if you're talking about PL/SQL inside Forms, you can use WEB.SHOW_DOCUMENT instead.
    Hope this helps,
    Pedro das Neves
    ([email protected])

  • Reading from a HTTP site from PL/SQL

    Hi,
    Can we able to access a http: URL from PL/SQL and read an XML from there?
    Regards
    Praveen Padala

    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_http.htm#ARPLS070

  • Redirect From PL/SQL Procedure

    Hi
    I hope this is a relatively straightforward question, but I am having trouble getting a page redirect to work from a PL/SQL procedure.
    I call the following procedure:-
    CREATE OR REPLACE PROCEDURE DOWNLOAD_FILE(p_id NUMBER) AS
    v_mime VARCHAR2(200);
    v_length NUMBER;
    v_file_name VARCHAR2(2000);
    lob_loc BLOB;
    v_session VARCHAR2(100);
    BEGIN
    v_session := v('SESSION');
    SELECT MIME_TYPE,
    FILE_CONTENT,
    FILE_NAME,
    DBMS_LOB.GETLENGTH(FILE_CONTENT)
    INTO v_mime,
    lob_loc,
    v_file_name,
    v_length
    FROM SRGSUP_UPLOADED_FILES
    WHERE ID = p_id;
    owa_util.mime_header(nvl(v_mime,'application/octet'),FALSE);
    htp.p('Content-length: ' || v_length);
    htp.p('Content-Disposition: attachment; filename="' || v_file_name || '"');
    owa_util.http_header_close;
    wpg_docload.download_file(lob_loc);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    htp.p('Location: f?p=107:30');
    END DOWNLOAD_FILE;
    From the following HTML Expression in column formatting of a report:-
    #FILE_NAME#: [ <a href="#OWNER#.DOWNLOAD_FILE?p_id=#FILE_ID#">Download</a> ]
    When the table SRGSUP_UPLOADED_FILES contains the relevant document the file download works perfectly. However, if there is no file present I wanted the page to redirect back to itself. Instead it goes to the login page.
    Initially I thought it was losing the session details so I tried "htp.p('Location: f?p=107:30:'||v('SESSION'));" but this made no difference.
    Any help would be appreciated.
    Thanks
    Chris
    Message was edited by:
    chrisjcoe

    Hi
    <p>I hope this is a relatively straightforward question, but I am having trouble getting a page redirect to work from a PL/SQL procedure. </p>
    <p>I call the following procedure:- </p>
    CREATE OR REPLACE PROCEDURE DOWNLOAD_FILE(p_id NUMBER) AS
    v_mime VARCHAR2(200);
    v_length NUMBER;
    v_file_name VARCHAR2(2000);
    lob_loc BLOB;
    BEGIN
      SELECT MIME_TYPE,
             FILE_CONTENT,
             FILE_NAME,
             DBMS_LOB.GETLENGTH(FILE_CONTENT)
      INTO v_mime,
           lob_loc,
           v_file_name,
           v_length
      FROM SRGSUP_UPLOADED_FILES
      WHERE ID = p_id;
      owa_util.mime_header(nvl(v_mime,'application/octet'),FALSE);
      htp.p('Content-length: ' || v_length);
      htp.p('Content-Disposition: attachment; filename="' || v_file_name || '"');
      owa_util.http_header_close;
      wpg_docload.download_file(lob_loc);
      EXCEPTION WHEN NO_DATA_FOUND THEN
      htp.p('Location: f?p=107:30');
    END DOWNLOAD_FILE;
    <p>From the following HTML Expression in column formatting of a report:- </p>
    [pre]
    "#FILE_NAME#: [ <*a h*ef="#OWNER#.DOWNLOAD_FILE?p_id=#FILE_ID#">Download</*a> ] "I've only put an "*" in <*a and </*a> to stop it changing into a url.
    <p>When the table SRGSUP_UPLOADED_FILES contains the relevant document the file download works perfectly. </p>
    <p>However, if there is no file present I wanted the page to redirect back to itself. Instead it goes to the login page. </p>
    <p>Initially I thought it was losing the session details so I tried "htp.p('Location: f?p=107:30:'||v('SESSION'));" but this made no difference. </p>
    <p>Any help would be appreciated. </p>
    <p>Thanks </p>
    <p>Chris</p>

  • Calling a url from a pl/sql proc

    HI!
    I was wondering if anybody has code that they can share calling a url from a pl/sql proc.
    Thanks!!

    Thanks - tell me if I am wrong but it does not seem to be what I need. does this package have the capabilities of doing the following... I want to call a pl/sql procedure - I am not in any browser window and by calling this proc it will bring up a browser window with the given url.

  • Retreiving URL from PHP redirect

    I've looked and found no real mention of this.
    Heres the situation:
    I'm trying to figure out what all I need in order to retrieve the URL from a redirect to a file.
    The situation is, the user/program places a request through a php script and then redirects the user/program to a file, such as a video, audio, or image. The destination server is different from the original location so thats what I want to retreive from the redirect.
    In browsers you can see the final URL with the actual server and path to the file. With everything I've tried, URLConnections, HttpURLConnections, et al. I always end up with is the request URL.
    Is there any easy way to retrieve that final URL with server, path, and filename?
    Thanks

    java.net.HttpURLConnection
    //setFollowRedirects
    public static void setFollowRedirects(boolean set)
    Sets whether HTTP redirects (requests with response code 3xx)
    should be automatically followed by this class.
    True by default.
    */

  • Sql item - get url from page

    Hi I'm trying to display a menu from a table, and then I want to mark the current page in that menu by reading the url of the current page.
    This is what i've got so far:
    DECLARE
    loc Varchar2(40);
    BEGIN
    loc := htp.script('document.url');
    htp.print('<table border=1>');
    for rec in (select id, name, parent_id, url from fgj_menu where parent_id=0) loop
       HTP.print ('<tr>');
       HTP.print ('<td><a href="' || rec.url || '">' || rec.name || '</a></td></tr>');
       for rec2 in (select id, name, parent_id, url from fgj_menu where parent_id = rec.id) loop
    if rec2.url = loc then
       HTP.print ('<tr>');
       HTP.print ('<td>  >> <a href="' || rec2.url || '">' || rec2.name || '</a></td></tr>');
    else
       HTP.print ('<tr>');
       HTP.print ('<td>    <a href="' || rec2.url || '">' || rec2.name || '</a></td></tr>');
    end if;
    end loop;
    END LOOP;
    htp.print('</table>');
    END;fails on 4th line :
    loc := htp.script('document.url');Any suggestions?
    Message was edited (format edits) by:
    Botzy

    Hi Botzy
    You can put your javascript code in an HTML portlet, but I prefer to put a page under htdocs, it's much easier to develop, and then use an url item that displays the url directly in the page.
    About the code :
    var xhr_object = null;
    if(window.XMLHttpRequest) // Firefox
         xhr_object = new XMLHttpRequest();
    else if(window.ActiveXObject) // IE
         xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
    xhr_object.open("POST", "/portal/pls/portal/my_schema.my_proc", true);
    xhr_object.onreadystatechange = function()
    if(xhr_object.readyState == 4) alert(xhr_object.responseText);
    xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xhr_object.send('p_param1=value1&p_param2=value2');
    That's really simple to use, you just have to change the name of your proc and its parameters, and you'll get what it "htp.prints". Be sure to grant exec to public on you proc.
    By the way, I've just imagined an even more simple solution :
    - do not pass any param to your procedure. Let it just write always the same code whatever the page it is on
    - identify each entry of your menu with a javascript id, for instance
    <table>
    <tr><td id="url1">page 1</td></tr>
    <tr><td id="url2">page 2</td></tr>
    etc...
    Then use a small javascript code at the end of your page with something lie this :
    document.getElementById(document.location.href).style = a different color
    or
    document.getElementById(document.location.href).innerHTML = something different
    or whatever you want.

  • Urgent ***Open OAF page from Pl/SQL***

    Hello All,
    we are sending an HTML email from Pl/sql,
    now the requirement is..In email body user will get request Id. This request Id will be Hyperlinked (Using HTML Tag). Once User click on Request id.. One OAF Page should Open.
    Our Problem is: when user click on request Id , OAF Page opens with below error:
    You have insufficient privileges for the current operation. Please contact your System Administrator
    When user click on Home Its redirecting to Username/Password page. After entering the Username/Password it doesn't go to desired page.
    We know the problem is with session maintenance.
    Any Idea How to achieve this functionality.
    Thanks,
    Ab

    Hello Sun,
    I have added function to Menu and Responsibility.
    In Function WEB HTML Tab I added HTML Call = OA.jsp?OAFunc=FWK_TOOLBOX_HELLO&OAHP=FWK_TOOLBOX_TUTORIAL_APP&OASF=FWK_TOOLBOX_HELLO
    My function Name is : XXGENZ_R2R_COA_DASHBOARD
    Now if I am trying to open below URL from browser..
    http://apps.oracle.com:12715/OA_HTML/OA.jsp?OAFunc=XXGENZ_R2R_COA_DASHBOARD&RequestId=3&RecordType=End-Date&StatusCode=Inprocess&DispositionCode=H1&ReadMode=Y
    But It dint work.. URL is directing to User name and password page..and If u enter the User name and password its redirect to Oracle Apps Home page...
    Thanks,
    AB

  • Calling secured web service from Pl SQL

    Hi
    I am trying to call a secured web service from pl/sql using utl_http.
    Is there a sample pl/sql program that i can refer to call a secured web service.
    sample soap header that am trying to acheive.
    <soap:Header>
    <wsa:Action>http://myactaction</wsa:Action>
    <wsa:MessageID>uuid:asdfadrewrwqr</wsa:MessageID>
    <wsa:ReplyTo>
    <wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>
    </wsa:ReplyTo>
    <wsa:To>http://myact</wsa:To>
    <wsse:Security soap:mustUnderstand="1">
    <wsse:UsernameToken wsu:Id="SecurityToken-321321">
    <wsse:Username>mordfsafsdae</wsse:Username>
    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">werwqrewrwe</wsse:Password>
    </wsse:UsernameToken>
    </wsse:Security>
    </soap:Header>
    Thanks a ton in advance

    Hi,
    On way we can call a web service is to pass the Web Service URL to UTL_HTTP package:
    Sample Web Service URL
    ===================
    lv_url :=
    'http://67.97.189.151:8888/plsqlsample/dbfunc?invoke=placeOrder'
    || '&'
    || 'param0=1'
    || '&'
    || 'param1=1'
    || '&'
    || 'param2=1';
    Sample Call using UTL_HTTP
    =====================
    SELECT UTL_HTTP.request (lv_url)
    INTO lv_result
    FROM DUAL;
    Thank you.
    Regards,
    Balu

  • Using MapViewer from PL/SQL vs Java

    Hi group!
    The MapViewer User's Guide has this to say about using MapViewer from PL/SQL:
    "The usage model for the SDO_MVCLIENT package is almost identical to that of
    MapViewer JavaBean-based API" etc etc .. "For usage and reference information about specific functions or procedures, see the description of the associated JavaBean-Based API. methods and interfaces in Chapter 4"
    If I don't misunderstand the basic concept, in a Java Web App (using the MapViewer Bean) you create a MapViewer object for each HTTP-user-session, like so:
    MapViewer mv = new MapViewer("http://my_corp.com:8888/mapviewer/omserver");
    ... which you would then store in the user's session object, so that the MapViewer Bean conveniently holds the map's state on the user's behalf.
    To do the equivalent in PL/SQL, the User's Guide suggests:
    "connect scott/tiger
    call sdo_mvclient.createmapviewerclient(
    'http://www.mycorp.com:8888/mapviewer/omserver') ;
    The preceding example creates, in the current session, a unique MapViewer client
    handle to the MapViewer service URL"
    Does "current session" refer to the HTTP-user-session? While I've used PL/SQL before, I've not used the PL/SQL Web Toolkit. Is the session handling implicit here (and invisible?) or should the sdo_mvclient be subsequently stored in the PL/SQL equivalent of a (J2EE) HttpSession object?
    YT

    Part of the answer will depend on how you plan to deploy the application. If you have a few, local clients you could go with the traditional client/server model. If you have a lot of clients and/or they are spread out over a relatively large area (like a campus setting), a web front-end will save you a lot of hassels down the road when it comes time to upgrade.
    Regardless of the the front end, I can tell you that I have been greatly impressed with the throughput you can get by moving most of the code to PL/SQL packages. A few years ago we reworked a VB/Oracle app by moving a lot of the code out of VB and into packages, leaving the client to essentially call procedures and format the output. We had more than a 3x performance increase on the same hardware and our network utilization decreased noticably.
    I am now in the process of replacing the client code with Java servlets/JSP, primarily because of the maintenance hassles I mentioned earlier. There are some limitations with an HTML page but most of these have been cosmetic so far.
    We are still relying heavily on PL/SQL packages. The servlet code basically gets a request, calls a package to get the data, then hands the results to a JSP page. The JSP then formats the output and sends it to the client. We are little more than halfway through the re-write, but it appears performance will increase again. Not as noticably as before, but I will take what I can get. As you have seen, once something is rolled out it always ends up getting used more than you anticipated. Better to over-engineer now than have to patch it once it is live.
    HTH

  • How do I redirect a link from one application to another

    Hi,
    I need to know if the procedure i'm using to perform a response.sendRedirect is the best/ most efficient. I'm using 11g 11.1.1.6.
    1. I have two JSF ADF applications deployed on a 11g BC4J application server.
    The two applications are named App1 and App2 in the application server (AS)
    App1 has a context path of /app1
    App2 has a context path of /app2
    I need to go to App2 from App 1 from a golink
    I using go link and in destination="/app2/faces/pages/home"/>
    and it redirects to this link like
    localhost:port/app1/app2/faces/pages/home?env=Prod"/>
    I actually want it to redirect to the second application and run it
    What is that I m doing wrong If I need to hardcord that value there
    Or is there any othe way that I can do .
    Thanks in Advance.
    Thanks,
    933601

    Hi Timo,
    Thanks for your help I could get that I m able to goto desired url from app1 to app2
    but the thing is I m using jdbc URL connection to deploy my application. After navigating to desired page
    I m trying to login to my page When I enter username and tabout for password
    It shows me an error like
    JBO-29114 AdfContext is not setup to process message for this exception. Use the exception stack trace and error code to investigate the root cause of this exception.
    Root cause error code is jbo-26061.
    Adf_Faces-60097: for more information see server log
    ADF_Faces-60096: server Exception
    While Deploying I checked my connections they are successful. I dont have any issue with the DB.
    What should I do in order to run my application with Jdbc Url.
    I m using 11.1.1.6 and BC4J.
    Please help me out with this..
    Thanks in Advance..

  • Calling a Web Service from PL/SQL Procedure

    How can you call a web service from a pl/sql package , also is it valid to call a web service from pl/sql according to Fusion Standards..

    Hi,
    On way we can call a web service is to pass the Web Service URL to UTL_HTTP package:
    Sample Web Service URL
    ===================
    lv_url :=
    'http://67.97.189.151:8888/plsqlsample/dbfunc?invoke=placeOrder'
    || '&'
    || 'param0=1'
    || '&'
    || 'param1=1'
    || '&'
    || 'param2=1';
    Sample Call using UTL_HTTP
    =====================
    SELECT UTL_HTTP.request (lv_url)
    INTO lv_result
    FROM DUAL;
    Thank you.
    Regards,
    Balu

  • Invoking Web Service From PL SQL package

    Below is the sample code to invoke web service from pl/sql package using UTL_HTTP:
    Declare
    http_req UTL_HTTP.req;
    http_resp UTL_HTTP.resp;
    Begin
    http_req :=
    UTL_HTTP.begin_request
    'http://'
    || lv_hosturl
    -- || '.net/soa-infra/services/finance_rt/Payments/paymentsprocess_client_ep',
    --new url
    || '.net/soa-infra/services/finance_rt/PaymentsReq/paymentsprocess_client_ep?WSDL',
    'POST',
    'HTTP/1.1'
    UTL_HTTP.set_header (http_req, 'Content-Type', 'text/xml');
    -- since we are dealing with plain text in XML documents
    UTL_HTTP.set_header (http_req,
    'Content-Length',
    LENGTH (lv_soap_request)
    UTL_HTTP.set_header (http_req, 'SOAPAction', '');
    -- required to specify this is a SOAP communication
    UTL_HTTP.write_text (http_req, lv_soap_request);
    http_resp := UTL_HTTP.get_response (http_req);
    UTL_HTTP.read_text (http_resp, lv_soap_respond);
    UTL_HTTP.end_response (http_resp);
    resp := XMLTYPE.createxml (lv_soap_respond);
    End;

    Hi,
    there are a lot of option to make plsql web services .
    First you can stay with jdev 10.1.3
    Use the xmldb servlets
    use jdev 11g tp4 to create plsql ws and upgrade to jdev 11g production
    And I think in the next release of jdev it will be back , there are more options which disappeared like the adf bc sdo ws or jmx datacontrol etc.
    thanks Edwin

Maybe you are looking for

  • Print range with JavaScript does not work on Mac

    Problem: I am using this.print({bUI: true, nStart: 1, nEnd: 2, bSilent: false}); to print a range of pages. Works perfectly on Reader 8 and 9 and AcroPro 8 in Windows XP. Works in AcroPro 8 on OSX 10.4 but not in Reader 8.1.2 or 9 in 10.4 or Leopard.

  • Delete Entries of Change Log Table

    Can any one tell me when do we require to delete the content of the change log table of standard DSO. I am just fresher to SAP BI. Thank You

  • Parameter Description value display on Crystal Report

    Hi I have created a Parameter based off OPCH.Project, so within the Project Parameter the values are the Project Codes and under Description I have the Project Names. Is it possible to display this Project Description value on the Crystal Report when

  • Assets Equal Liabilities and Equity

    Hi Team, When I am trying to close a period in ECCS consolidation monitor, I am getting error "Assets Equal Liabilities and Equity". Actually we are archiving ECCS data in development environment. When archiving ECCS tables, we are getting error ECCS

  • Lion OS, MACBook Pro; HP Envy 100

    HI i am running LION on my MBP.  Just bought the HP E100 printer; loded OK onto my network (time machine).  HP-Provided cd not supported by LION; HP references to APPLE Support lead nowhere, APPLE references to HP Lead similarly.  any thoughts?