How to call javascript function from PL/SQL procedure

Can anybody advice me how to call javascript function from PL/SQL procedure in APEX?

Hi,
I have a requirement to call Javascript function inside a After Submit Process.
clear requirement below:
1. User selects set of check boxes [ say user want to save 10 files and ticks 10 checkboxes]
2. user clicks on "save files" button
3. Inside a After submit process, in a loop, i want to call a javascript function for each of the file user want to save with the filename as a parameter.
Hope this clarify U.
Krishna.

Similar Messages

  • Calling Javascript function from PL/SQL Process

    I am new to APEX and Javascript so please forgive my question.
    I have a process on page which successfully runs a few procedures etc. but now, as part of this process, I want to call a javascript function I have typed into the HTML Header.
    My question is how can I call the javascript function from my process? Is it possible?
    Many thanks
    Winnie
    ps. as an example my javascript looks like:
    <script language="JavaScript">
    function test(){
    var decision = confirm("Click a button below and watch what pops up next.");
    alert(decision);
    </script>

    See: How to call a javascript function from pl/sql?

  • Call javascript functions from PL/SQL

    Hi !
    I just want to know if it is possible to call a javascript function from a PL/SQL procedure. If yes, anybody can explain me the syntax ?
    Thanks
    Chantale

    You can call Java Script - kind of.
    PL/SQL has a "web browser" called UTL_HTTP. It allows you to make HTTP calls to a web server. This includes a function that can be used from SQL too (with a size limitation).
    Example:
    SQL> select UTL_HTTP.Request( 'http://some-web-server' ) as HTML_PAGE from dual;
    HTML_PAGE
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <META HTTP-EQUIV="Refresh" CONTENT="1;URL=http:/some-web-server:7777/index">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <img src="images/Wave.gif">
    Redirecting.. please standby..
    <hr>
    </html>
    SQL>The call to the web browser can be to execute and load, for example, a JSP page.
    However, if the page containts client-side Java script, i.e. code for the web browser to execute, than UTL_HTTP will merely return the contents & code of that page.
    Client-side Java Script requires an engine in the browser. The JS language is used to manipulate the rendering engine of the browser.
    The PL/SQL "web browser" does not have a display device to show a web page. Thus it is without a web browser rendering engine and therefore also cannot execute Java Script either.

  • How to call java function from PL/sql in oracle applications

    I am trying to call a java function from plsql procedure. Can any one explain how to call java function, and in which directory I have to store my java function in oracle applications. Do I need to register that java function from Application developer.
    Thanks
    Kranthi

    http://www.oracle.com/technology/tech/java/jsp/index.html
    Good Luck,
    Avi.

  • Calling Javascript function from PL/SQL Page Process

    Hi All,
    So far I have seen many threads that answered the question: Calling a PL/SQL from a Javascript function. I would like to know if it's posiible to do the reverse process as follows:
    DECLARE
       v_name APPLICANTS.NAME%Type;
       v_surname APPLICANTS.SURNAME%Type;
       v_idNumber APPLICANTS.ID_NUMBER%Type;
    BEGIN
       select name, surname
       into v_name, v_surname
       from APPLICANTS
       where id_number = :P2_ID_NUMBER;
       //Javascript function call Syntax is what i'd like find out
       onchange="javascript:show_Name(v_name,v_surname);";
    EXCEPTION
       WHEN OTHERS
       THEN
       onchange="javascript:show_Exception(v_name,v_surname);";
    END;& Javascript function to shiow applicant's details is:
    function show_Name(item1,item2){
       alert('Applicant's Name is: '  + item1 + ' & Surname is: ' + item2);
    }THANK YOU!
    Regards
    Kamo

    Hi Dinesh, Thanks for the response!
    I've also tried doing the following without success:
    DECLARE
       v_name APPLICANTS.NAME%Type;
       v_surname APPLICANTS.SURNAME%Type;
       v_idNumber APPLICANTS.ID_NUMBER%Type;
    BEGIN
       select name, surname
       into v_name, v_surname
       from APPLICANTS
       where id_number = :P2_ID_NUMBER;
       htp.p('<script type="text/javascript">');
       htp.p('
                alert('Applicant's Name is: '  + v_name + ' & Surname is: ' + v_surname);
       htp.p('</script>');
    EXCEPTION
       WHEN OTHERS
       THEN
       htp.p('<script type="text/javascript">');
       htp.p('
             alert('Exception.');
       htp.p('</script>');;
    END;Do you know why this is not working?
    Regards
    Kamo

  • How to call java class from pl/sql procedure ?

    Hello everyone,
    My query is..
    There is one pl/sql stored procedure which is doing some business logic and storing data in some columns of one table, suppose the table name is 'ABC' .. and the rest of columns of table ABC are getting updated using java class. Now my problem is whenever I insert data in ABC using store proc.. i have to call that java class so that it will update the rest columns ( why java class for updating the columns in ABC is ..because that logic cant be done from pl/sql proc.. it has to be done using java )
    and the other thing is.. oracle is in one machine and java is in another .. :(
    hope ..u can help me out !!
    Thank in advance !!

    but that updation have to be done from java code only.. we are using GIS tools .. have to create some shape files and update the column with that shape file.. so creation of shape file has to be done from java code only..
    so how to call java class file which is on another machine and oracle in another..

  • How to call oracle function from ejb3

    i'm trying to call an oracle query-function from ejb3.
    The oracle function:
    create or replace FUNCTION getSecThreadCount(secId in NUMBER,avai in NUMBER)
    RETURN SYS_REFCURSOR is cur SYS_REFCURSOR;
    m_sql VARCHAR2(250);
    BEGIN
    m_sql:='select count(thrId) from thread where secId='|| secid||'
    and thrAvai='|| avai;
    open cur for m_sql;
    return cur;
    END;
    I'v tried several ways to call it,but all failed:
    1. the calling code:
    public Object getSectionThreadCount(int secId,int avai){
              Query query=manager.createNativeQuery("{call getSecThreadCount(?,?) }");     
              query.setParameter(1, secId);
              query.setParameter(2, avai);
              return query.getSingleResult();
    but i got the exception:
    Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    Caused by: java.sql.SQLException: ORA-06550: row 1, col 7:
    PLS-00221: 'GETSECTHREADCOUNT' not procedure or not defined
    ORA-06550: row 1, col 7:
    PL/SQL: Statement ignored
    2. the calling code:
    @SqlResultSetMapping(name = "getSecThreadCount_Mapping")
    @NamedNativeQuery(name = "getSecThreadCount",
    query = "{?=call getSecThreadCount(:secId,:avai)}",
    resultSetMapping = "getSecThreadCount_Mapping",
    hints = {@QueryHint(name = "org.hibernate.callable", value = "true"),
              @QueryHint(name = "org.hibernate.readOnly", value = "true")})
    public Object getSectionThreadCount(int secId,int avai){
              Query query=manager.createNamedQuery("getSecThreadCount");     
              query.setParameter("secId", secId);
              query.setParameter("avai", avai);
              return query.getSingleResult();
    but i run into the exception:
    Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    Caused by: java.sql.SQLException: lost in index IN or OUT parameter:: 3
    By the way, i have successfully called the function from hibernate. And i use oracle 11g, JBoss5 RC1.
    Could anyone tell me how to call the function from EJB3?
    Thanks.

    Here's a working model:
    package.procedure: (created in example schema scott)
    CREATE OR REPLACE package  body data_pkg as
      type c_refcursor is ref cursor;
      -- function that return all emps of a certain dept
      function getEmployees ( p_deptId in number
      return c_refcursor
      is
        l_refcursor c_refcursor;
      begin
         open l_refcursor
        for
              select e.empno as emp_id
              ,        e.ename as emp_name
              ,        e.job   as emp_job
              ,        e.hiredate as emp_hiredate
              from   emp e
              where  e.DEPTNO = p_deptId;
        return l_refcursor;
      end getEmployees;
    end data_pkg;
    /entity class:
    package net.app.entity;
    import java.io.Serializable;
    import java.util.Date;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.NamedNativeQuery;
    import javax.persistence.QueryHint;
    import javax.persistence.SequenceGenerator;
    import javax.persistence.Table;
    @SuppressWarnings("serial")
    @Entity
    @Table (name="emp")
    @SequenceGenerator(name = "EmployeeSequence", sequenceName = "emp_seq")
    @NamedNativeQuery( name = "getEmpsByDeptId"
                   , query = "{ ? = call data_pkg.getEmployees(?)}"
                   , resultClass = Employee.class
                   , hints = { @QueryHint(name = "org.hibernate.callable", value = "true")
                          , @QueryHint(name = "org.hibernate.readOnly", value = "true")
    public class Employee implements Serializable
        @Id
        @Column(name="emp_id")
        @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EmployeeSequence")
        private int id;
        @Column(name="emp_name")
        private String name;
        @Column(name="emp_job")
        private String job;
        @Column(name="emp_hiredate")
        private Date hiredate;
        // constructor
        public Employee (){}
        // getters and setters
        public int getId()
         return id;
    etc...session bean:
    package net.app.entity;
    import java.util.ArrayList;
    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
    import net.app.entity.Employee;
    import net.app.iface.ScottAdmin;
    @Stateless
    public class ScottAdminImpl implements ScottAdmin
        @PersistenceContext
        private EntityManager entityManager;
        @SuppressWarnings("unchecked")
        public List<Employee> getEmployeesByDeptId(int deptId)
         ArrayList<Employee> empList;
         try
             Query query = entityManager.createNamedQuery("getEmpsByDeptId");
             query.setParameter(1, deptId);
             empList = (ArrayList<Employee>) query.getResultList();
             return empList;
         catch (Exception e)
             e.printStackTrace(System.out);
             return null;
    }client:
    package net.app.client;
    import java.util.List;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import net.app.entity.Employee;
    import net.app.iface.ScottAdmin;
    public class ScottClient
        public static void main(String[] args)
         try
             // create local interface
             InitialContext ctx = new InitialContext();
             ScottAdmin adminInterface = (ScottAdmin) ctx.lookup("ScottAdminImpl/remote");
             // select employees by deptno
             int deptno = 20;
             List<Employee> empList = adminInterface.getEmployeesByDeptId(deptno);
             // output
             System.out.println("Listing employees:");
             for (Employee emp : empList)
              System.out.println(emp.getId() + ": " + emp.getName() + ", " + emp.getJob() + ", " + emp.getHiredate());
         catch (NamingException e)
             e.printStackTrace(System.out);
    }Basically you just ignore the refcursor outbound parameter.
    This is a stored function, have yet to try outbound refcursor parameters in stored procedures...
    Edited by: _Locutus on Apr 2, 2009 2:37 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Call JavaScript function from Acrobat Plugin

    Hi All,
    I want to call JavaScript function from Acrobat Plugin? Where is to write JavaScript function in Acrobat SDK? Please reply..
    Thanks in advance..

    Hi Malkyt,
    Thanks.. where is to write JavaScript code in the application..
    function GetWelcome()
    alert("Welcome");
    this above code. how to use this javascript code to plugin application.
    static ACCB1 ASBool ACCB2 AVPageViewMouseClick (AVPageView pageView, AVDevCoord xhit, AVDevCoord yhit, AVFlagBits16 flags, AVTCount clickNo, void *data)
    char jsscript[200];
    AFExecuteThisScript (pddoc, jsscript, NULL);
    i want to display welcome message of JS file.. give me step to perform above task.. Please reply...

  • How to call web services from PL/SQL?

    Hi,
    Can one help in how to call web services from PL/SQL? Steps, pros and cons, etc....
    Thanks in advance

    Here's some example skeleton code to get you started...
      PROCEDURE p_soap_request(p_username IN VARCHAR2, p_password IN VARCHAR2, p_proxy IN VARCHAR2) IS
        soap_request  VARCHAR2(30000);
        soap_respond  CLOB;
        http_req      utl_http.req;
        http_resp     utl_http.resp;
        resp          XMLType;
        soap_err      exception;
        v_code        VARCHAR2(200);
        v_msg         VARCHAR2(1800);
        v_len number;
        v_txt Varchar2(32767);
      BEGIN
        UTL_HTTP.SET_PROXY(p_proxy);
        -- Define the SOAP request according the the definition of the web service being called
        soap_request:= '<?xml version = "1.0" encoding = "UTF-8"?>'||
                       '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">'||
                       '  <SOAP-ENV:Body>'||
                       '    <m:DownloadRequest xmlns:m="http://www.website.net/messages/GetDetails">'||
                       '      <m:UserName>'||p_username||'</m:UserName>'||
                       '      <m:Password>'||p_password||'</m:Password>'||
                       '    </m:DownloadRequest>'||
                       '  </SOAP-ENV:Body>'||
                       '</SOAP-ENV:Envelope>';
        http_req:= utl_http.begin_request
                  ( 'http://www.website.net/webservices/GetDetailsService.asmx'
                  , 'POST'
                  , 'HTTP/1.1'
        utl_http.set_header(http_req, 'Content-Type', 'text/xml');
        utl_http.set_header(http_req, 'Content-Length', length(soap_request));
        utl_http.set_header(http_req, 'Download', ''); -- header requirements of particular web service
        utl_http.write_text(http_req, soap_request);
        http_resp:= utl_http.get_response(http_req);
        utl_http.get_header_by_name(http_resp, 'Content-Length', v_len, 1); -- Obtain the length of the response
        FOR i in 1..CEIL(v_len/32767) -- obtain response in 32K blocks just in case it is greater than 32K
        LOOP
            utl_http.read_text(http_resp, v_txt, case when i < CEIL(v_len/32767) then 32767 else mod(v_len,32767) end);
            soap_respond := soap_respond || v_txt; -- build up CLOB
        END LOOP;
        utl_http.end_response(http_resp);
        resp:= XMLType.createXML(soap_respond); -- Convert CLOB to XMLTYPE
      END;Using secure web services (https)...
    Web serivces call in Plsql
    As for 'pros and cons'... there's nothing to compare against... either you want to call a web service or you don't.

  • How to call a function from asp

    Hi!, I'd like to know how to call a function from an asp page. I've written:
    set rs = server.createobject("Adodb.recordset")
    rs.open "call dbo.sf_Obt_Des_Producto ('0000161')",Conn
    if err.description <> "" then
    response.write ("No se pudo! :(")
    else
    response.write ("rs: " & rs(0))
    end if
    rs.close
    set rs = nothing
    but there is an error:
    ORA-06576: not a valid function or procedure name
    Please is very urgent!!!
    Thanks.
    Angie.

    You need to use the syntax "{call <procedure_name>}".
    The {call } syntax tells the OLE DB provider that it needs to translate the call into whatever the database's procedure calling syntax is. This means that even though different databases have different syntax for calling stored procedures, your OLE DB code can be run against any of them without changing.
    Justin

  • How to call javascript function?

    Hi,
    How to call javascript function for SAP button
    control onclick event?
    Thanks in advance.

    Hi Sundar,
      u can call java script  in design mode.
      Add this code in ur design part inside body and call the function as
    <sap:button id="a" onSelect="javascript:go();"
    Add inside body:
      <script language="javascript>
    function go(){
    alert("hai");
      </script>
    Regards,
    Vinoth.M

  • Calling javascript function from report customization form

    I have been unable to call any user-defined javascript function from Portal Report Customization forms.
    Even a simple Message Box function doesn't work. I've been placing my code in the ..after header PL/SQL section for the report customization form.
    htp.p('<script type="javascript">');
    htp.p('function MsgBox(message){');
    htp.p('alert(message);}');
    htp.p('</script>');
    htp.p('See if it works');
    I have verified in plain html that my syntax is fine. Even the syntax rendered by portal is correct:
    <script type="javascript">
    function MsgBox(message){
    alert(message);}
    </script>
    See if it works
    Despite this, you will get a javascript error that an Object is expected, MsgBox not defined. Clearly from the script above MsgBox is defined.
    I have tried any number of calls to user defined functions and can't get anything to work. However, calling native functions like 'alert' works fine ( ie
    See if it works
    Anyone know how I can call a user defined javascript function in a Portal Report Customization form?

    Try changing the code
    htp.p('<script type="javascript">');
    to
    htp.p('<script language="javascript">');
    Thanks
    -Krishnamurthy

  • How to call a function with pl/sql

    How does one call a function with pl/sql that uses a function?

    Hi,
    How does one call a function with pl/sql that uses a
    function?I'm not sure what you mean.
    In PL/SQL function can be used just about anywhere where an expression (with the same data type that the function returns). Arpit gave a very common example.
    Here's another example, where all the functions take a single NUMBER argument and return a NUMBER, so they can all be used in places where NUMBERs are used:
    IF  fun_a (fun_b (0)) < fun_c (1)
    THEN
        UPDATE  table_x
        SET     column_y = fun_d (2)
        WHERE   column_z = fun_e (ROUND ((fun_f (3), fun_g (4)));You call a function simply by using its name, followed by its argument list, if any.
    If the function is in a package, you must call it with the package name, like "pk_foo.bar (1, 2, 3)", unless the call comes from within the same package.
    If the function is owned by someone else, you must give the owner name, like "scott.bar (SYSDATE)" or "scott.pk_foo.bar (1, 2, 3)". You can create synonyms to avoid having to name the owner.

  • Calling JavaScript function from Servlet ?

    I have a Servlet that needs to call a general purpose JavaScript function to retrieve some data. The JavaScript function sits in a file on the web server called general.js.
    How can I call this function from my servlet to retrieve an integer result ?
    Sarah.

    http://developer.netscape.com/docs/manuals/js/client/jsguide/index.htm
    Look for Java to JavaScript communication.

  • How to call javascript function with dynamic data in display tag

    Hi,
    Iam new to pagination concept. Iam using display tag to display rows in jsp by strtus.
    I have a problem when calling the javascript function using ahref in attribute in display tag.
    <bean:define name="form1" property="EditDetails.List" id="ListDisplay"/>
    <display:table name="pageScope.ListDisplay" cellpadding="0" cellspacing="1" pagesize="10" partialList="false" size="listSize" requestURI="">
    <display:column property="poNo" href='javascript:searchEditDetails("./submitOrder.do? actionID=getMISLoadEdit&poNumberSel=<%=((com.po.bean.EditDetails)poListDisplay).getNo()%>&statusIdSelected=<%=((com.po.bean.EditDetails)ListDisplay).getStatusId()%>")'
    title="Number"/>                         
    <display:column property="strDate"title="Date" />
    <display:column property="orderValue"title="Order Value(INR)"/>
    <display:column property="stringRequestedDeliveryDate"title="Suggested Delivery Date"/>
    <display:column property="statusDescription" title="Status" />
    </display:table>
    The above code display the data in row format is working fine when I click the No It thow javascript error and its not redirecting to the other page.
    When I try this with ordinary struts its working fine the code is:
    <logic:iterate id="polist" name="Form1" property="EditDetails.List" indexId="i" type="com.bean.EditDetails">
    <tr>
    <td ><a href="javascript:searchEditDetails("./submitOrder.do?actionID=getMISLoadEdit&NumberSel=<%=((com.bean.EditDetails)polist).getNo()%>&statusIdSelected=<%=((com.bean.EditDetails)polist).getStatusId()%>")"><html:hidden name="polist" property="No" write="true" /></a>     </td>
    <td><html:hidden name="polist" property="strDate" write="true" /></td>
    <td><html:hidden name="polist" property="orderValue" write="true" /></td>
    <td><html:hidden name="polist" property="stringRequestedDeliveryDate" write="true" />     </td>
    <td><html:hidden name="polist" property="statusDescription" write="true" /></td>
    </tr>
    </logic:iterate>
    Please help me how to call javascript with dynamic data.
    Thanks in advance

    The ADF Mobile Container Utilities API may be used from JavaScript or Java.
    Application Container APIs - 11g Release 2 (11.1.2.4.0)

Maybe you are looking for

  • HP Color LaserJet 1515n fails to print

    HP Color LaserJet 1515n fails to print I had this printer just 13 months, and it has stopped working without giving any kind of error code. I ran my black down to 1% using override - and then nothing. The printer accepts jobs and appears to do everyt

  • Java3D SDN's HelloUniverse1 Help

    Hello, Im trying to learn Java3D, Im very new to Java as it is... im using SDN's HelloUniverse1 Example but am having real difficulties when trying to run it. Im getting this error: renderer.doWork(long) Line:776 renderer(J3dThread).run() Line: 250 A

  • Libraries on mac

    hi I'm using an Imac 2009 with 2.66 Ghz processor Intel Core i5: Untill one moth ago I had all my libraries (aperture and itunes) located ,as defaoult, on my mac HD. Then I had a problem with the system because I'm usyng too much space (700 GB used a

  • Making payment online is impossible​!

    I've been trying to make a payment online for the last hour unsuccessfully, the screennshot bellow shows the error tough all the inormation is correct: Your Verizon Account Information has changed since your previous login to 'Pay Bill.' For security

  • Binding Controller context nodes to two (RFC)models

    Hi group, i have an table, which is based on an BAPI_GET. This table is editable - and I want to update the data in R/3 with another bapi BAPI_SET. BAPI_GET and BAPI_SET have the same structure T_DATA as "table". Unfortunately I cannot bind the eleme