HTML DB - pl/sql in a Javascript

Hi everybody,
Is it possible to incorporate this in this javascript ?
URL Link
javascript:
wwv_flow_collection.truncate_collection
(p_collection_name => 'INFO_ENTITE');
javascript:window.close();
Is it possible to do this ?
Thanks. Bye.

Hello,
I have these examples though that do just that I don't have the right procedure plugged in but I will have them working by tommorow.
http://htmldb.oracle.com/pls/otn/f?p=11933:59
Another trick I've done is instead of a window.close on your original load of the page do a doSubmit('CLOSE') to the page and and have the first load of your page use a page process to delete your collection and your second load when the request=CLOSE call window.close;
Carl
Message was edited by:
Carl Backstrom

Similar Messages

  • HTML DB pL/SQL avec du Javascript

    Bonjour tout le monde,
    Est-ce qu'il est possible d'incorporer www_flow_collection.... dans le javascript ?
    Lien URL
    javascript:
    wwv_flow_collection.truncate_collection
    (p_collection_name => 'INFO_ENTITE');
    javascript:window.close();
    Est-ce qu'il est possible de faire ça ?
    Merci. Au revoir.

    When Javascript runs it runs on your PC and has no connection to the database, so Javascript cannot invoke a PL/SQL procedure.
    Why not just create an HTML DB page process that fires when the "Quit Application" button is pressed and have that process call the PL/SQL procedure?
    Mike

  • Connecting SQL server using JavaScript

    I found an article on connecting SQL server using JavaScript. http://www.devarticles.com/c/a/JavaScript/Combining-North-Pole-with-South-Pole-JavaScript-with-SQL-Server-2000/
    Do you people think it's possible? i try out the code already but something wrong with it. I just copy and paste it to a html file but it comes out with error. Do I miss out something? Thanks.
    SY Tee

    Check the permissions and server authentication from the below link,
    http://technet.microsoft.com/en-us/library/ms179354(v=sql.90).aspx
    Regards, RSingh

  • Example of calling PL/SQL func in JavaScript

    I need to validate a form element based on existing database value and give an alert. Does anyone know how to capture the value returned by a PL/SQL func in JavaScript variable? Thanks.

    hi,
    in the PL/SQL block 'before form displayed'
    insert the code:-
    htp.p('{script}var myVar = "' | | myPLSQLfunc | | '";{script}');
    (I have replaced the less-than and greater-than symbols with {} so that they will show in the browser)
    The variable myVar will now be available to JavaScript in the page and will have the value returned by myPLSQLfunc.
    Regards Michael.

  • How validate HTML using PL/SQL

    Hi,
    I try validate HTML using PL/SQL that user inputs.
    I did create below function for that purpose
    CREATE OR REPLACE
    FUNCTION validate_html(
      p_html IN VARCHAR2
    ) RETURN BOOLEAN
    AS
      l_comment  XMLTYPE;
      xml_parse_err EXCEPTION;
      PRAGMA EXCEPTION_INIT (xml_parse_err , -31011);
    BEGIN
      l_comment := xmlType.createXML('<root><row>' || p_html || '</row></root>');
      RETURN TRUE;
    EXCEPTION WHEN xml_parse_err THEN
      RETURN FALSE;
    END;
    Function works ok and return true if I run e.g.
    BEGIN
      IF validate_html('<p>Hello</p>') THEN
        dbms_output.put_line('OK');
      ELSE
        dbms_output.put_line('Not valid HTML');
      END IF;
    END;
    And return false if I enter not valid HTML like
    BEGIN
      IF validate_html('<p>Hello') THEN
        dbms_output.put_line('OK');
      ELSE
        dbms_output.put_line('Not valid HTML');
      END IF;
    END;
    But it return false also if I run below
    BEGIN
      IF validate_html('<p>Hello &nbsp</p>') THEN
        dbms_output.put_line('OK');
      ELSE
        dbms_output.put_line('Not valid HTML');
      END IF;
    END;
    Problem seems to be that &nbsp (there is ; in end but do not know how post it without forum convert that to space) witch is valid HTML for me.
    I know that HTML is not XML, but can I use Oracle database XML functions for validating HTML?
    How I should validate user inputted HTML?
    I'm currently developing this using Oracle XE 11G database.
    Regards,
    Jari

    Not an elegant way:
    But try this.........
    CREATE OR REPLACE FUNCTION validate_html (p_html IN VARCHAR2)
       RETURN BOOLEAN AS
       l_comment       XMLTYPE;
       xml_parse_err   EXCEPTION;
       PRAGMA EXCEPTION_INIT (xml_parse_err, -31011);
    BEGIN
       l_comment :=
          xmlType.createXML (
             '<root><row>'
             || CASE
                   WHEN INSTR (p_html, '&') > 0 THEN
                      UTL_I18N.escape_reference (p_html)
                   ELSE
                      p_html
                END
             || '</row></root>');
       RETURN TRUE;
    EXCEPTION
       WHEN xml_parse_err THEN
          RETURN FALSE;
    END;
    SET DEFINE OFF
    SET SERVEROUTPUT ON
    BEGIN
       IF validate_html ('<p>Hello') THEN
          DBMS_OUTPUT.put_line ('OK');
       ELSE
          DBMS_OUTPUT.put_line ('Not valid HTML');
       END IF;
    END;
    SET DEFINE OFF
    SET SERVEROUTPUT ON
    BEGIN
       IF validate_html ('<p>Hello &nbsp</p>') THEN
          DBMS_OUTPUT.put_line ('OK');
       ELSE
          DBMS_OUTPUT.put_line ('Not valid HTML');
       END IF;
    END;
    Cheers,
    Manik.

  • Several html widgets I created contain the javascript libraries. Is there a way to create a common javascript library that can be accessed by all my widgets? I'm trying to reduce the size of the ibook I'mm creating.

    Several html widgets I created contain the javascript libraries. Is there a way to create a common javascript library that can be accessed by all my widgets? I'm trying to reduce the size of the ibook I'm creating.

    Seen this thread?
    Can javascript libraries be shared across widgets?

  • Access PL/SQL Objects from JavaScript

    I have following Problem:
    I want to have access to a pl/sql object from javascript.
    for example:
    i have a procedure with a parameter called test from Type Test.
    PROCEDURE toTest (
    test Test)
    IS
    BEGIN
    htp.script('here i want the value of test', 'javascript');
    would be really great if somebody can help me fast.
    thanks a lot
    holger

    I think it might have something to do with htmldb_Get
    Hope that clue gets you somewhere. I would love to see a working example of this for 4.02 if anyone actually has one.
    Regarding dynamic actions there's a severe limit on the number of them I believe.29? Which is one reason I avoid them and
    just do things in javascript. Personally I think javascript is actually easier to understand because one does not have to
    divide an actiivity up into several pieces. But that might just be specific to my brain, I don't know.

  • JSP/Servlets functions: clear HTML tags, clear SQL code, validate E-mail

    Hello!
    I am looking for java functions, which:
    - clear HTML tags
    - clear SQL injection code
    - validate an e-mail address
    Probably there are java build-in functions for doing that.
    Maybe anyone could give me their names?
    I would be also grateful for any help, links or something.

    Hi,
    You could try using ,
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    instead of
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    -Amol

  • HTML in PL/SQL block

    How to add "Welcome" using HTML in the following PL/SQL block. I want to add the Welcome user message when user login in to the Apex application.
    BEGIN
      HTP.prn(get_app_user);
    END;Sanjay

    Got the solution. Modified the PL/SQL block as follows :
    BEGIN
    htp.print('<p>Welcome');
    HTP.prn(get_app_user);
    htp.print(' to My application.<p>');
    END;
    Sanjay
    Edited by: user12957777 on 8 Nov, 2010 10:35 PM

  • OAS 4.0.8 fail to send complete HTML from PL/SQL sp

    OAS 4.0.8 may fail to send complete HTML response from the PL/SQL cartridge sometimes. It also varies with different browsers or even with different versions of the same browser. Sometimes it works OK, sometimes the HTML was broken. I tried to figure out the reason, but only realized that the proxy server might cause the problem. As I disabled the proxy server setting on my browser at school(the server is on campus), it worked. However, as I did the same thing at home, it did not work. I am confused what the problem is. That trouble never happened for the previous version OAS 3.0.1. Anybody can help me with that. The ORACLE staff in Taiwan did not come out with the solutions!

    OAS 4.0.8 may fail to send complete HTML response from the PL/SQL cartridge sometimes. It also varies with different browsers or even with different versions of the same browser. Sometimes it works OK, sometimes the HTML was broken. I tried to figure out the reason, but only realized that the proxy server might cause the problem. As I disabled the proxy server setting on my browser at school(the server is on campus), it worked. However, as I did the same thing at home, it did not work. I am confused what the problem is. That trouble never happened for the previous version OAS 3.0.1. Anybody can help me with that. The ORACLE staff in Taiwan did not come out with the solutions!

  • HTML table containing SQL output in cells

    Hello,
    This might be a built-in function, but I haven't figured out how to do this: I want to display an HTML table (2x3 table) and in each cell, I want to display the output from different SQL statements. Some of the SQL statements return multiple rows, some just one. The cell data comes from unjoined tables, that is there is no join condition between each one of the cell SQL statements, it's a bit random.

    After much head-banging, I have worked this out and it came down to just changing 2 style definitions in the page template. I'm not really a Web developer so that wasn't obvious to me (or easy, I've read quite a bit on Google about stylesheets while working this).
    Basically I wanted to display a 3x3 "grid", similar to a table, but the data coming out from the 3x3 regions (all SQL query regions) returned different numbers of rows, which meant my page "rows" didn't align horizontally, they were just rendered wherever the last region stopped (vertically they were rendered properly because I put the regions in Colums 1, 2 and 3, standard page functionality).
    Eventually I started looking at the HTML page source and noticed the regions were using style defintions coming from my theme (standard APEX theme #12). I made a copy of the page template this page was using, and modified the header block of the new page template to "rewrite" the driving styles
    <title>#TITLE#</title>
    <link rel="stylesheet" href="#IMAGE_PREFIX#themes/theme_12/theme_V3.css" type="text/css" />
    <style type="text/css">
    a.plain { font-family:arial; text-decoration:none}
    td.t12Header {height=12px;font: italic small-caps 900 12px arial}
    td.t12Body {background-image: url(#APP_IMAGES#lock.png);background-repeat: no-repeat;background-position: left top;vertical-align= middle;height= 250px}
    </style>
    ...So I re-wrote the td (or table TD style) for t12Header and t12Body, by adding my own style definitions into the header after the call to the main css sheet. I also played around with putting a background image into each cell, I'll probably remove that but it was fun to explore.
    This rendered my individual table cells (via td.t12Body) @ 250px (which as I've found out is otherwise not supported, there's no built-in TABLE spec for "height") -- exactly what I wanted, now all the regions render vertically and horizontally.
    I did not test this with any browser other than IE7.
    If you know an easier way to do this, please do post a follow-up.

  • HTML Tags in sql

    Hi guys
    Im executing the below sql with the html tags, as it gone mess and returning error like invalid table name.
    SELECT '<p style="font-family: Script MT Bold;color: #800080;font-size:35px;text-align: center;">' || 'Welcome' || PAPF.FULL_NAME|| '</p>
    <p style="font-family: Times New Roman;color: #000000;font-size:15px;text-align: center;"> The Employees Information of</p>
    <p style="font-family: Times New Roman;color: #000000;font-size:20px;text-align: center;"> <strong>Central Bank of Kuwait</strong>'
    FROM FROM PER_ALL_PEOPLE_f PAPF, FND_USER FU
    WHERE PAPF.PERSON_ID = FU.EMPLOYEE_ID AND
    TRUNC(SYSDATE) BETWEEN PAPF.EFFECTIVE_START_DATE AND
    PAPF.EFFECTIVE_END_DATE
    Im not sure whether i missed any || or quotes in html tags while using with the column name in the select statement
    Thanks in advance.
    Regards,
    Vel

    Don't do this via the SQL selection as hardcoded HTML??
    I think the following 2 approaches far superior.
    If you need the actual SQL projection to contain HTML, implement user functions for data transformation. E.g.
    SQL> create or replace function MakeDiv(
      2          divBody varchar2,
      3          fontColor varchar2 default 'black',
      4          tooltip varchar2 default null )
      5  return varchar2 is
      6          DIV_TEMPLATE constant varchar2(4000) :=
      7          '<div style="color:$COLOR" title="$TOOLTIP"> $BODY </div>';
      8 
      9          htmlDiv varchar2(4000);
    10  begin
    11          htmlDiv := replace( DIV_TEMPLATE, '$BODY', divBody );
    12          htmlDiv := replace( htmlDiv, '$COLOR', fontColor );
    13          htmlDiv := replace( htmlDiv, '$TOOLTIP', tooltip );
    14          return( htmlDiv );
    15  end;
    16  /
    Function created.
    SQL>
    SQL> select MakeDiv( ename, 'blue', 'Employee '||empno ) from emp;
    MAKEDIV(ENAME,'BLUE','EMPLOYEE'||EMPNO)
    <div style="color:blue" title="Employee 7369"> SMITH </div>
    <div style="color:blue" title="Employee 7499"> ALLEN </div>
    <div style="color:blue" title="Employee 7521"> WARD </div>
    <div style="color:blue" title="Employee 7566"> JONES </div>
    <div style="color:blue" title="Employee 7654"> MARTIN </div>
    <div style="color:blue" title="Employee 7698"> BLAKE </div>
    <div style="color:blue" title="Employee 7782"> CLARK </div>
    <div style="color:blue" title="Employee 7788"> SCOTT </div>
    <div style="color:blue" title="Employee 7839"> KING </div>
    <div style="color:blue" title="Employee 7844"> TURNER </div>
    <div style="color:blue" title="Employee 7876"> ADAMS </div>
    <div style="color:blue" title="Employee 7900"> JAMES </div>
    <div style="color:blue" title="Employee 7902"> FORD </div>
    <div style="color:blue" title="Employee 7934"> MILLER </div>
    14 rows selected.
    SQL> An even better approach is not to do this in the SQL projection - but instead have a PL/SQL framework that accepts a SQL, and turns the SQL projection of that SQL into a HTML report. Where this framework can use different templates to generate different types of HTML reports.
    This approach is very successfully used by Oracle Apex.

  • Needed help on java script and html in PL/SQL doing nothing

    Hi,
    Created a procedure which takes username and password and changes OID, database password for that user with that password.
    I created a page in oracle portal and trying to call this below script package:
    BEGIN
    user_name := portal.wwctx_api.get_user;
    HTP.p
         <!-- BEGIN CODE FRAGMENT -->
         <script language="javascript">
         <!--
         function ValidatePass()
         var passStr = document.getElementByid("p_password").value;
         var confPassStr = document.getElementByid("Confirm_Password").value;
              var pattern = /[^a-zA-Z0-9]/;
              if (passStr == null || passStr == "") {
                   alert("Password value missing");
                   return;
              if (confPassStr == null || confPassStr == "") {
                   alert("Confirm password value missing");
                   return;
              if (passStr.match(pattern) == null && confPassStr.match(pattern) == null) {
                   if (passStr == confPassStr) {
                        document.form.submit();
                   } else {
                        alert("Your entries did not match. Please try again!");
              } else {
                   alert("Invalid charcters entered");
         //-->
         </script>
         <form name="changepassword"
         action="http://<hostname>:7777/pls/sys/sys.gx_user_mgt.globally_update_password"
              method="post" AutoComplete="Off">
    <input type="hidden" name="username" value=" '
    || user_name
    || ' " id="p_username"/>
    New Password:
    <input type="password" name="p_password" id="p_password">
    <br>
    <br>
    Confirm Password:
    <input type="password" name="Confirm_Password" id="Confirm_Password">
    <br>
    <br>
    <input style="padding:2px;" type="submit" value=Login onClick="ValidatePass();">
    </form>
    END;
    This gx_user_mgt.globally_update_password is the custom procedure I should call passing username and p_password
    Thanks in advance.

    Friends I want to try something but I am totally lost on how to achieve it.Just to let u know that I have not worked in JAVASCRPT at all.And I am in great hurry to finish this work.
    What I am looking for is :
    1) a JSP page is thrown
    2) a button is clicked
    3)Moment the button is clicked I want a file to be created with an extension HTML (having all the info from the database) by using FileWriter class .After the file is created and ready ,Then I want to open this file in another browser window.
    I know that to achieve this I have to use Javascript,but I am totally lost on how to do that.
    I mean can I say in JAVASCRIPT that if this button is clicked then execute a java method which retrives data from the oracle database in the server and writes it to a HTML file and then after the writing is done,open it another window.
    Please help.

  • SQL Query in Javascript

    Hi All,
    I have an SQL query which needs to be invoked when ever javscript function is called.
    Is it possible in Oracle Apex to embed a SQL query in the javascript function...If so, Please can anyone provide me with a right syntax ???
    Regards,
    Sandeep Reddy

    Thank you so much for your reply..
    I tried implementing it but facing the problem in PL/SQL code defined in the application process.. I am getting the coloum name is invalid..however, the coloum is valid for the table.
    declare
    lineprice LINEITEM%rowtype;
    Begin
    select LineUnitPrice
    into lineprice
    from LINEITEM
    where PriceCategoryID = :PRICECATEGORY AND LineItemID = :LINEITEM;
    htp.prn(lineprice);
    exception when others then htp.prn('An error occurred retrieving record');
    end;
    sqlerrm:ORA-06550: line 7, column 45:PL/SQL: ORA-00904: "LINEITEMID": invalid identifierORA-06550: line 4, column 1:PL/SQL: SQL Statement ignoredORA-06550: line 8, column 1:PLS-00306: wrong number or types of arguments in call to 'PRN'ORA-06550: line 8, column 1:PL/SQL: Statement ignored
    Please let me the know the correct path to sort out this problem..

  • Help with anonymus pl/sql layout using javascript

    Hi people.
    i want to display some records on a region (using apex 4.2) , this anonymous pl/sql script below shows 3 records from database, but the layout only shows me the first record with it's data, the others 2 records, only show me labels.
    i have verified this same query creating a report and it shows the 3 records correctly.
    i guess i am doing something wrong with this javascript routine or i am surely missing something,
    in this link you can see the layout i am getting. (http://sdrv.ms/Xrv0J8).
    the other little help i need is to display in one row for each record. actually i am getting one row for each label and one row for each data record. i have read and found is something about /div, but i don't no how to change it to get desired results, any suggestion is welcome.
    thanks in advance for any help.
    i am completely new in apex and java script, but i have several years experience in pl/sql.
    The Script :
    Begin
    Declare
    Cursor Deliv Is
    Select item,
    To_char (Delivery, 'month dd, yyyy hh24:mi:ss') Delivery,
    Current_date
    From pending_items;
    Begin
    For A In Deliv Loop
    Begin
    Sys.Htp.P ('<script type="text/javascript">');
    Sys.Htp.P ('function cdtd() {');
    Sys.Htp.P (' var xmas = new Date("' || a.delivery || '")');
    Sys.Htp.P (' var now = new Date();');
    Sys.Htp.P (' var timeDiff = xmas.getTime() - now.getTime();');
    Sys.Htp.P (' if (timeDiff <= 0) {');
    Sys.Htp.P (' clearTimeout(timer);');
    -- Sys.Htp.P (' document.write("Some Text Here!");');
    Sys.Htp.P (' // Run any code needed for countdown completion here');
    Sys.Htp.P (' }');
    Sys.Htp.P (' var seconds = Math.floor(timeDiff / 1000);');
    Sys.Htp.P (' var minutes = Math.floor(seconds / 60);');
    Sys.Htp.P (' var hours = Math.floor(minutes / 60);');
    Sys.Htp.P (' var days = Math.floor(hours / 24);');
    Sys.Htp.P (' hours %= 24;');
    Sys.Htp.P (' minutes %= 60;');
    Sys.Htp.P (' seconds %= 60;');
    Sys.Htp.P (' document.getElementById("daysBox").innerHTML = days;');
    Sys.Htp.P (' document.getElementById("hoursBox").innerHTML = hours;');
    Sys.Htp.P (' document.getElementById("minsBox").innerHTML = minutes;');
    Sys.Htp.P (' document.getElementById("secsBox").innerHTML = seconds;');
    Sys.Htp.P (' var timer = setTimeout("cdtd()",1000);');
    Sys.Htp.P ('}');
    Sys.Htp.P ('</script>');
    Sys.Htp.P ('Days ');
    Sys.Htp.P ('<div id="daysBox"></div>');
    Sys.Htp.P ('Hours');
    Sys.Htp.P ('<div id="hoursBox"></div>');
    Sys.Htp.P ('Minutes');
    Sys.Htp.P ('<div id="minsBox"></div>');
    Sys.Htp.P ('Seconds');
    Sys.Htp.P ('<div id="secsBox"></div>');
    Sys.Htp.P ('<script type="text/javascript">');
    Sys.Htp.P ('cdtd();</script>');
    End;
    End Loop;
    End;
    End;

    Let's focus on your delivery dates and javascript for now.
    Why you would put your javascript in htp.p calls in a plsql region is quite beyond me. When you edit the page there is a javascript region where you can put global variables and functions, an excellent spot for this then, and a lot more maintainable than this.
    Now it's also obvious that your query on pending items will return more than one record. So, using a report would serve you well in this case. However, using code like this:
    document.getElementById("daysBox").innerHTML = days;
    document.getElementById("hoursBox").innerHTML = hours;
    document.getElementById("minsBox").innerHTML = minutes;
    document.getElementById("secsBox").innerHTML = seconds;will not serve you. getElementById is meant to return one element uniquely identified by an ID. If you have a report with multiple rows, and elements on each row with the same ID, you are doing something wrong. You would need the delivery date per row, and I guess that you put out your code with htp.p because you do not know how to deal with that and passing it in to the javascript procedure.
    But wouldn't it be more oppurtune for you to simply create a report with a source sql where you calculate each part of the date, and then refresh this region with a certain interval. If you'd refresh every 5 minutes, wouldn't that be more than fast enough to keep track of things? Don't forget, refreshing a region will execute the sql again.
    It's not that you can't accomplish a multirecord report with a countdown per row, but are you comfortable enough with javascript and jquery to code and maintain that versus leveraging plsql and dynamic actions (there is even a dynamic action timer plugin provided by oracle)?

Maybe you are looking for