Passing pl/sql variables to javascript function

hi! in a dynamic page, i've got the javascript:
<html>
function onCall(A,B)
<oracle>
Select aDate, Name from test;
b_rec b_cur%rowtype;
htp.p(</body onload="onCall('||b_rec.aDate||','||b_rec.Name||'";');
</oracle>
how can i pass in as onCall('12-Jun-2002','TestUser'), with the single quotes?
the above pass in as onCall(12-Jun-2002, TestUser) which the javascript will throw an error message.
thx.

hi! got it by chance:
htp.p('<body onload="onBirth('''||BDay||''','''||BPerson||''');">');
rgds.

Similar Messages

  • How to pass a jsp variable into javascript??

    <p><%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
    <p><%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
    <p><html>
    <p><c:set var="binrmapi" value="http://localhost/paas-api/bingorooms.action;jsessionid=XXXXXX?userId=TEST2&sessionId=1&key=1" />
    <p><c:import var="testbinrm" url="${fn:replace(binrmapi, 'XXXXXX', jsessionid)}"/>
    <p><c:set var="tuples" value="${fn:split(testbinrm, '><')}" />
    <p>Time until next game
    <p><c:forEach var="tuple" items="${tuples}">
    <p><c:if test="${fn:contains(tuple, 'row ')}">
    <p> <p><code>
    <p> <c:set var="values" value="${fn:split(tuple, '=\"')}" />
    <p> <font color="blue">
    <p> <c:out value="${values[17]}" />
    <p><c:set var="remainingtime" value="${values[17]}" />
    <p> </font>
    <p> </code>
    <p></c:if>
    <p></c:forEach>
    <p><form name="counter"><input type="text" size="8" name="d2"></form>
    <p><script>
    <p>var milisec=0
    <p>var seconds=eval("document.myForm.remaining").value;
    <p>function display(){
    <p> if (milisec<=0){
    <p> milisec=9
    <p> seconds-=1
    <p>}
    <p>if (seconds<=-1){
    <p> milisec=0
    <p> seconds+=1
    <p> }
    <br>else
    <p> milisec-=1
    <p> document.counter.d2.value=seconds+"."+milisec
    setTimeout("display()",100)
    <p>}
    <p>display()
    <p></script>
    <p></body>
    <p></html>
    <p>This is my code that i was working on, in the jsp part of the script, i get a api call and save a value of time in the variable remainingtime.. and in the javascript, i try to have a countdown clock counting down the remaining time.. but i guess it doesnt work.. how can i get that working? thanks alot
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001

    Re: How to pass a jsp variable into javascript??Here is the sameple one, hope it will solves your problem.
    <html>
    <body>
    <form name=f>
    <%!
    String str = "A String"
    %>
    <script>
    var avariable = <%=str%>
    <script>
    </form>
    </body>
    </html>
    Let me know if you face any problem

  • Passing pl/sql variable to Oarcle  procedure to java program

    Dear
    Sir/madam
    From java its easy to call procedure or function to get pl/sql variables like cursor type or varray type and cast back to that equi type thro' oracle extn package.Is there any way it could be done vice versa.Can i pass Oarcles Pl/SQL datatype like collection Of type Varray/Custom Object or Cursor,Array type to a procedure or function from java program.Is it possible to pass like that.If so could you kindly give a samll eaxample or URL where same type of example could be found
    regards
    kingshu

    Dear
    Sir/madam
    From java its easy to call procedure or function to get pl/sql variables like cursor type or varray type and cast back to that equi type thro' oracle extn package.Is there any way it could be done vice versa.Can i pass Oarcles Pl/SQL datatype like collection Of type Varray/Custom Object or Cursor,Array type to a procedure or function from java program.Is it possible to pass like that.If so could you kindly give a samll eaxample or URL where same type of example could be found
    regards
    kingshu i suggest to read JPublisher doc - it help support or convert PL/SQL types in Java
    http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96658.pdf
    Kuassi

  • Passing pl/sql variable to oracle procedure from java

    Dear
    Sir/madam
    From java its easy to call procedure or function to get pl/sql variables like cursor type or varray type and cast back to that equi type thro' oracle extn package.Is there any way it could be done vice versa.Can i pass Oarcles Pl/SQL datatype like collection Of type Varray/Custom Object or Cursor,Array type to a procedure or function from java program.Is it possible to pass like that.If so could you kindly give a samll eaxample or URL where same type of example could be found
    regards
    kingshuk

    Dear
    Sir/madam
    From java its easy to call procedure or function to get pl/sql variables like cursor type or varray type and cast back to that equi type thro' oracle extn package.Is there any way it could be done vice versa.Can i pass Oarcles Pl/SQL datatype like collection Of type Varray/Custom Object or Cursor,Array type to a procedure or function from java program.Is it possible to pass like that.If so could you kindly give a samll eaxample or URL where same type of example could be found
    regards
    kingshu i suggest to read JPublisher doc - it help support or convert PL/SQL types in Java
    http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96658.pdf
    Kuassi

  • Setting the value of a java variable in javascript function

    How can i set the value of a java variable in a javascript function?
    <%
    String fName = "";
    %>
    now i want to define a javascript function which can set the value of fName to the value it has been passed.
    <script language="javascript">
    function setJValue(val)
    </script>
    Thanks

    The only way you could simulate this, would be call the same page inside the Javascript function, and send it the parameter that was passed. Then you would have your Java code retrieve this parameter by request.getParameter("value");, and set the variable accordingly.

  • Passing a parameter to a javascript function

    I have declared a <jsp:usebean> on my jsp to extract a flag from the request. I want to then pass this String as a parameter to a javascript function called on the body onload. What is the best way of doing this? The javascript function is embedded in the jsp - does this mean I can access the variable directly, without even passing it as a parameter? do I use the <%= > syntax to reference the String on the onload? Do I use the <bean:write> the extract the varible within he javascript. Any help appreciated....

    JSP runs first on the server, and generates the HTML page with javascript.
    The javascript then runs on the client - it can't call any more JSP code, without submitting a request.
    In this case, you will want to use JSP to generate the javascript code that you need to run as a string on the page. You should probably use the <%= %> or the <bean:write tag>
    eg
      <script>
      <!--
        function loadForm(){
          var userName = "<%= user.getName() %>";
          alert("Hello " + userName);
      //-->
      </script>Note again. The use.getName() function will run on the server and produce static html/javascript like this
    var userName = "evnafets";
    JSP CODE DOES NOT RUN ON THE CLIENT. You cannot use JSP code to react to button clicks on the form for instance.
    Hope this helps,
    evnafets

  • Passing Pl/Sql variables into shell variables.

    I have written a file that ftp information from one pc to another in unix.
    All you have to do is supply a user_name/password and machine name to which ftp program will connect to.
    All connection information like user_id,password, machine name are stored in an oracle table FTP_TBL.
    It has the following fields:
    FTP_TBL
    ================
    USER_ID      NOT NULL VARCHAR2(100);
    USR_PASSWD      NOT NULL VARCHAR2(50);
    TO_MACHINE     NOT NULL VARCHAR2(50);
    I have called a pl/sql script in unix shell.
    This script selects all the connection information from FTP_TBL and populates the pl/sql variables with the
    information.
    Now i want the pl/sql variables like V_TO_MACHINE,V_USR_ID,V_USR_PASSWD to be passed on to unix variables
    To_MACHINE, USR_ID AND USR_PASSWD.
    How can i do this?
    ============================================================================================================
    sqlplus -s <<+++ >> $LOG_FILE
    $USER/$PASSWD
    set serverout on SIZE 1000000
    DECLARE
    V_TO_MACHINE VARCHAR2(100);
    V_USR_ID VARCHAR2(50);
    V_USR_PASSWD VARCHAR2(50);
    BEGIN
         BEGIN
              SELECT TO_MACHINE, USER_ID, USR_PASSWD
              INTO V_TO_MACHINE,V_USR_ID,V_USR_PASSWD
              FROM FTP_TBL;
         EXCEPTION
              when others then
              dbms_output.put_line('ERROR|SQLPLUS|'||ERROR||'|'||sqlcode||'|Failed during selecting configuration information.'||sqlerrm );
         END;
    END;
    +++
    #======================== VARIABLES =====================
    TO_MACHINE=$1
    USR_ID=$2
    USR_PASSWD=$3
    #========================== MAIN ========================
    ftp -vnd $TO_MACHINE << ++ 1>>$STA_LOG_FILE 2>&1
    user $USR_ID $USR_PASSWD
    prompt off
    get $OR_DATA_DIR/ASC.STADATA $HOME_DIR/ASC.STADATA
    bye
    ++
    # testing the exit status of FTP
    egrep "Transfer complete" $STA_LOG_FILE >/dev/null
    if [ $? = 0 ]
    then
    echo >> $STA_LOG_FILE
    echo "FTP Successfully Done" >> $STA_LOG_FILE
    else
    echo >> $STA_LOG_FILE
    echo "FTP UnSuccessfull" >> $STA_LOG_FILE
    exit 1
    fi

    Here an example of how to pass variables to the shell script :
    TEST@db102 SQL> select ename, job, dname from emp,dept
      2  where empno = 7902
      3  and emp.deptno = dept.deptno;
    ENAME      JOB       DNAME
    FORD       ANALYST   RESEARCH
    TEST@db102 SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    [ora102 work db102]$ cat disp_var.sh
    set `sqlplus -s test/test << EOF
    set pages 0
    select ename, job, dname from emp,dept
    where empno = 7902
    and emp.deptno = dept.deptno;
    exit
    EOF`
    echo $1 $2 $3
    [ora102 work db102]$ ./disp_var.sh
    FORD ANALYST RESEARCH
    [ora102 work db102]$                                                  

  • How to pass Application Item value in Javascript function.

    Hi,
    I have the following javascript in the HTML Form Element Attributes properties
    I am on Page1 and passing P1_DEPT_NO page item value. This is working perferctly fine and I am able to get the exact value of the page item
    onchange="javascript:function1($x('P1_DEPT_NO').value);"I am on Page1 and passing Application Item G_DEPT_NO value.
    The problem here is, I am not getting the Application item value inside the javascript function.
    I tried using alert(); and it's giving me value as undefined
    onchange="javascript:function1($x('G_DEPT_NO').value);"Just want to know, how to pass the Application Item value in Javascript.
    Thanks,
    Deepak

    Deepak,
    I am not an expert at Javascript, but the suggestin I made was because javascript is a case-sensitive language.. and therefore onChange is not the same as onchange.
    Not quite sure if that is causing the problem.
    Application items are not associated with a page and therefore have no user interface properties.
    Therefore, as mentioned in another post, the rendering would not work for application items.
    If it is for a single item, used only in this page, you could create a hidden page item and use it fo your purpose
    If you still want to look at application items and AJAX, This page contains examples of using AJAX to solve problems like the one you mentioned.
    http://www.oracle.com/technology/obe/hol08/apexweb20/ajax_otn.htm#t1b
    Thanks,
    Rajesh.

  • Pass a Java Bean into Javascript function.

    Good day. Please help urgent :
    I am trying to pass an instance of MyBean class into a javascript function
    This code is added to the form.
         private String getJavaScriptForLaunchNewComponent()
              StringBuffer sb = new StringBuffer();
              sb.append("<SCRIPT language='JavaScript'>");
              sb.append("    function testFunction(zBean) { ");
              sb.append("popAssetWinSpecs = \"left=250,top=250,width=300,height=300,scrollbars=no,toolbar=no,menubar=no,resizable=no,status=no,titlebar=no,location=no\";");
    sb.append("htmlfile=\"/irj/servlet/prt/portal/prtroot/com.roche.mss.pdf.comp.PDFLauncher?zBean=\"+zBean;");
    sb.append("window.open(htmlfile,\"editWindow\",popAssetWinSpecs);");
    sb.append("return false;");
    sb.append("    }");
    sb.append("</SCRIPT>");
    return sb.toString();
    This code is set in the create component meth
         private Component buildLink(){
              GridLayout grid = new GridLayout(1,1);
              grid.setCellSpacing(5);
              TestBean zBean = new TestBean();
              zBean.setValue("Me Now");
              Link link = new Link("myLink");
              link.addText("Print PDF");
              link.setOnClientClick("testFunction("+zBean +")");
              grid.addComponent(1,1,link);
              return grid;
    Is this possible ????
    Thanks.

    solved it. Thanks

  • Pass a url variable to javascript for drop down menu

    Hello,
    I'm in over my head as far as javascript goes. This is what I
    am trying to do. I have this URL...
    http://www.grasshorse.com/prod2.cfm?SortBy=all&ProdAbbr=shm
    I want to take the variable for ProdAbbr which in this case
    is "shm" and make that a variable in javascript. So that I can add
    the variable to a dynamic link I'm using for a drop down menu.
    mm_menu_0520211545_0.addMenuItem("All Departments","location='prod.cfm?SortBy=all&ProdAbb r=eval(ProdAbbr)'");
    I really have no clue what to do. I haven't hardly used
    javascript at all and I'm looking for some charity. Does anyone
    have any ideas on how I can do this?
    Thanks
    Steve
    Any insight is greatly appreciated.

    jawwinker wrote:
    > Hello,
    > I'm in over my head as far as javascript goes. This is
    what I am trying to
    > do. I have this URL...
    >
    > <a target=_blank class=ftalternatingbarlinklarge
    > href="
    http://www.grasshorse.com/prod2.cfm?SortBy=all&ProdAbbr=shm
    >
    > I">
    http://www.grasshorse.com/prod2.cfm?SortBy=all&ProdAbbr=shm
    >
    > I</a> want to take the variable for ProdAbbr which
    in this case is "shm" and
    > make that a variable in javascript. So that I can add
    the variable to a
    > dynamic link I'm using for a drop down menu.
    >
    >
    mm_menu_0520211545_0.addMenuItem("All Departments","location='prod.cfm?Sort
    > By=all&ProdAbbr=eval(ProdAbbr)'");
    mm_menu_0520211545_0.addMenuItem("All Departments","location='prod.cfm?Sort
    By=all&ProdAbbr='"+ProdAbbr+"'");
    Mick

  • How to pass a LOV variable to javascript?

    Hi All,
    I have a drop down list (LOV) with the following entry in Element Attributes:
    onChange="javascript:show_value(this);"
    The javascript is like this:
    function show_value(taskid)
    document.getElementById('P28_TEST_ONLY').value = taskid;
    However when I activate the script all I see in the P28_TEST_ONLY text filed is:
    [object]
    How can I pass the taskid (which is a number) so that I see it in my textfiled?
    Kind regards,
    Pawel.

    Luckily I found the answer to this myself. Just needed to change the parameter to 'object' like this:
    function show_value(object)
    document.getElementById('P28_TEST_ONLY').value = object.value;
    Hope it helps. Regards,
    Pawel.

  • How should I pass complicated sql statements to a function ?

    Hello
    Some built-in functions, such as dbms_advisor.quicktune accepts sql statements as in parameters. Those parameters are treated as varchar2, but if the sql statement is complicated and contain " ' " characters then its hard to pass those params, Sometimes they arent parsed correctly.
    How should I pass a complicated statement (with subqueries, strings and so) to a function ?
    Thanks
    Guy

    user11973359 wrote:
    Hello
    Some built-in functions, such as dbms_advisor.quicktune accepts sql statements as in parameters. Those parameters are treated as varchar2, but if the sql statement is complicated and contain " ' " characters then its hard to pass those params, Sometimes they arent parsed correctly.
    How should I pass a complicated statement (with subqueries, strings and so) to a function ?
    Thanks
    GuyWhats your db verzion. To over come the single quotes issue in string you can use q'[]' representation of string.
    select q'[Karthick's]' from dual

  • In this way you can access pl/sql variables in javascript

    Because nobody seems to know the answer (because of no reply) to my post a few days ago and in the meanwhile I found it out myself, I will give the solution:
    Create or Replace PROCEDURE KOEN.PROC_GET_FIELD
    (OBJ_NAME IN VARCHAR2, OBJ_VALUE OUT VARCHAR2)
    pl/sql procedure (with embedded javascript) to get the value of a form field by passing the name of that field (in the same way you can write such a procedure to set the value of a form field by passing the field's name and value
    as
    v_obj_name VARCHAR2(255);
    begin
    v_obj_name := '.' || OBJ_NAME || '.';
    htp.htmlOpen; htp.headOpen;
    htp.p('<script language = "JavaScript1.2">');
    htp.p('for (i=0; i < document.forms[0].length; i++)');
    htp.p('{');
    htp.p('var v_name = document.forms[0].elements.name');
    htp.p('if (v_name.indexOf("' || v_obj_name || '") != -1)');
    htp.p('OBJ_VALUE = document.forms[0].elements[i].value;');
    htp.p('}');
    htp.p('</script>');
    htp.headClose; htp.htmlClose;
    exception
    when others then
    null;
    end;
    regards,
    Koen

    i have written a getField to get the value of a form field procedure but how can I write a setField procedure??
    Create or Replace PROCEDURE KOEN.PROC_SET_FIELD
    (OBJ_NAME IN VARCHAR2, OBJ_VALUE IN VARCHAR2)
    pl/sql procedure Koen V. (with embedded javascript) to get the value of a form field by passing the name of that field (in the same way you can write such a procedure to set the value of a form field by passing the field's name and value
    as
    v_obj_name VARCHAR2(255);
    begin
    v_obj_name := '.' || OBJ_NAME || '.';
    htp.htmlOpen; htp.headOpen;
    htp.p('<script language = "JavaScript1.2">');
    htp.p('for (i=0; i < document.forms[0].length; i++)');
    htp.p('{');
    htp.p('var v_name = document.forms[0].elements.name');
    htp.p('if (v_name.indexOf("' || v_obj_name || '") != -1)');
    htp.p('document.forms[0].elements[i].value = "' || OBJ_VALUE || '";');
    htp.p('}');
    htp.p('</script>');
    htp.headClose; htp.htmlClose;
    exception
    when others then
    null;
    end;
    greets,
    Koen

  • Calling PL SQL in a Javascript function

     

    I've written a function :
    function removeCouvent (id)
    //var empSelectObj = document.getElementById(empSelect);
    var ajaxRequest = new
    htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=Del_couvent',0);
    ajaxRequest.add('CodeCouv',id);
    ajaxResult = ajaxRequest.get();
    if(ajaxResult)
              alert("test1");
         else
              alert("test2");
    ajaxRequest = null;
    with the pl / sql app process (Del_couvent) :
    BEGIN
    DELETE FROM COUVENT WHERE CV_CODE= :CodeCouv;
    END;
    It does nothing, no deletes, any idea ?

  • How to put a jsp variable into a javascript function?

    Please read the following coding. I want to pass the variable ans from jsp to the function check_answer() of javascript. ans is a string got from database. But I cannot put the variable ans into the Javascript function. Can anyone help?
    <script language="Javascript">
    function check_answer() {
    if (testing.result.value==ans ){
    window.alert("You have got 10 marks.");
    </script>
    <body>
    <form name="testing"...>
    <%
    ResultSet rs = stmt.executeQuery("select * from level where...");
    while(rs.next())
    out.println("<tr>");
    out.println("<td>" + rs.getString("question") + "</td>");
    ans = rs.getString("answer");
    out.println("</tr>");
    out.println("<input type='text' name='result'>);
    out.println("<input type='button' value='Enter' onclick='check_answer()'>");
    %>

    The following should be able to pass ans.
    <script language="Javascript">
    function check_answer(ans) {
    if (testing.result.value==ans ){
    window.alert("You have got 10 marks.");
    </script>
    <body>
    <form name="testing"...>
    <%
    ResultSet rs = stmt.executeQuery("select * from level where...");
    while(rs.next())
    out.println("<tr>");
    out.println("<td>" + rs.getString("question") + "</td>");
    ans = rs.getString("answer");
    out.println("</tr>");
    out.println("<input type='text' name='result'>);
    out.println("<input type='button' value='Enter' onclick='check_answer('<%= ans%>')'>");
    %>jag

Maybe you are looking for

  • How do I install Snow Leopard as a partition with Yosemite on a 2001 Mac Mini?

    I have owned Mac's on and off since the 80's.  I currently own (myself and my kids) a 2008 MBP, iPhone 4 and 4s, 2 old iPhone 3's, just purchased a 2011 Mac Mini and iPhone 6, and my work-from-home computer is a 4 month old MBP. Several years ago, I

  • CAN I GET AN UPGRADE FOR MY OJ PRO 8600 TO A 8600 Preium

    I have a hp OJ 8600 pro eprint can i buy and upgrade to a 8600 pro preium.  I would to be able to scan duplex.

  • Filtering values in It

    Dear Experts,   I have an Internal Table like below, X        Y        Z 1        A       10 1        B       20 2        A       10 2        B       30 3        C       50 3        C       60 3        C       90     I need to select the  highest Z v

  • What is the benefit of "Enable Final Cut Studio color compatibility" in QT?

    Hi(Bonjour)! What is the benefit of "Enabling Final Cut Studio " in Quicktime player? I'm used to calibrate my monitor to a less bright gamma, suitale for monitoring video content. So does the +color compatibility option+ can give me more precision w

  • Finding path to my photos

    I was attempting to download my photos, had some difficulties and now cannot access my photos through IPhoto. When I try to open IPhoto, the screen shows loading photos with a spinning wheel, but nothing happens. When I go to the IPhoto menu, almost