Setting a value to variable using an sql and javascript

Hello

I'm trying to be a value of variables using javascript and sql. The code is as below:


< script >
function getDueDate() {}
function getVal (item) {}
If ($x (point) .value! = "")
Return parseFloat ($x (item) .value);
on the other
Returns a null value.
}
$x('P26_DUE_DATE').value = select sysdate + $x ('P26_PAY_TERM') of the double
}
< /script >

Can this be achieved?

Hello

JS and SQL are 2 different languages, so you can't do what you want to do using this script. The good thing is that you can still do so using JS.

$x('P26_DUE_DATE').value = select sysdate + $x ('P26_PAY_TERM') of the double

the "Select Sysdate" try to use the date JS Object (http://www.w3schools.com/jS/js_obj_date.asp) to add dates together.

Martin
-----
[http://apex-smb.blogspot.com/]
[http://apex.stackexchange.com/]

Tags: Database

Similar Questions

  • How to set the value of QUERY using PL/SQL process?

    Hello

    I use APEX 4.2...
    How to set the value of the REQUEST using process of PL/SQL which lies before the header - where the value of the REQUEST should appear on the URL?

    Kind regards
    Fateh

    You cannot set a value of demand in a PL/SQL block. You can run a PL/SQL block on a request which is the id of a button for example.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Apress.com/9781430235125
    http://Apex.Oracle.com/pls/Apex/f?p=31517:1
    http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
    -------------------------------------------------------------------

  • Set a value of Application using PL/SQL element

    I have a question of enforcement F101_MAINTENANCE it needs is the value set according to the values in a table. The value would be a piece of HTML code.

    Ideally this would be verified every time that a page is loaded and the value is printed on the screen on every page.

    Is there a way to do this?

    I use 4.0.2 on 11g

    Hi Craig,.

    To set an application using PL/SQL item value:

    // some examples
    :F101_MAINTENANCE := 'some value';  // a varchar
    :F101_MAINTENANCE := 123;           // a number
    :F101_MAINTENANCE := SYSDATE;       // a date
    

    The varchar 'some value' could be HTML and could be HTML with the values of a table concatenated, like this:

    DECLARE
       l_ename VARCHAR2(100);
    BEGIN
       SELECT ename INTO l_ename
       FROM emp
       WHERE empl_id = 123;
    
       :F101_MAINTENANCE := 'Empl name: ' || l_ename || '';
    END;
    

    (Take the space out of the style attribute - it's just there because the forum keeps style stripping attribute when displaying the post values.)

    This could be in a process of page to fire when the page loads. If she has to work for all pages, it could be in an application process set on fire during the loading of each page. If it should work for all but a few pages, you can place the code in an application process on fires during each page load, but then put a condition on it so it is not fire for specific pages.

    Now that the application is defined, it can be used on the pages where you need. If it is used for display only, remember to not escape special characters, or else it will just display the HTML rather than surrender. And if the value of the element of the application only needs to be set in PL/SQL, be sure to set the protection of session state so that he can "Restricted - cannot be resolved in the browser.

    Hope this helps,
    John

    If you find this information useful, please indicate the 'useful' or 'correct' post so that others benefit. *

  • Get and set the value to allow selected rolling Shuffle and facing page

    Hello world

    I work with the page and spread,

    For now, I want to value page spead shuffle and type of document.

    but I just find the function to get and set the value for the Document Pages allow Shuffle using the

    InterfacePtr < IPageLayoutPrefs > iPageLayoutPrefs (static_cast < IPageLayoutPrefs * > (: QueryPreferences (IID_IPAGELAYOUTPREFERENCES, iDocument)))

    It has no function to set and get the value of enable selected rolling Shuffle and facing page

    No one knows about it?

    I thank in advance

    There is no code for this example in the SDK or internet. Just understand and apply the concept.

    Find the code for the shuffle spread and together following spread shuffle...

    // Get active spread
    UIDRef GetActiveSpread() {
        UIDRef spreadRef = UIDRef::gNull;
    
        InterfacePtr layoutData(Utils()->QueryFrontLayoutData());
        if(layoutData) {
      spreadRef = layoutData->GetSpreadRef();
      }
    
      return spreadRef;
    }
    
    // Get spread shuffle of passed in spread
    bool16 GetSpreadShuffle(UIDRef& spreadRef) {
        InterfacePtr spread(spreadRef, UseDefaultIID());
        if(!spread)
      return kFalse;
    
      InterfacePtr iBoolData(spread, IID_IISLANDSPREAD);
        if(iBoolData) {
            return iBoolData->GetBool();
        }
    
        return kFalse;
    }
    
    // Set spread shuffle of passed in spread
    // @param bValue: kTrue = no shuffle, kFalse = allow shuffle
    ErrorCode SetSpreadShuffle(UIDRef spreadRef, bool16 bValue) {
        ErrorCode status = kFailure;
    
        InterfacePtr spreadCmd(CmdUtils::CreateCommand(kSetIslandSpreadCmdBoss));
        if(!spreadCmd)
            return status;
    
        spreadCmd->SetItemList(UIDList(spreadRef));
    
        InterfacePtr iBoolData(spreadCmd, UseDefaultIID());
        if(iBoolData) {
            iBoolData->Set(bValue);
        }
    
        status = CmdUtils::ProcessCommand(spreadCmd);
        return status;
    }
    
  • Tricky SQL - is possible using just SQL and not of PL/SQL

    Hi all

    Here's my data

    create table experience (exp_id number (10), exp_name varchar2 (20), root_exp_id number (10));
    insert into a values (642, 'Test', 5172) experience;

    create table experience_node (exp_node_id number (10), exp_node_type_id number (2));
    insert into experience_node values (5172, 1);
    insert into experience_node values (5173, 2);
    insert into experience_node values (5174, 2);

    create table experience_connector (exp_conn_id number (10), exp_conn_type_id number (2), exp_node_id number (10), parent_exp_node number (10));
    insert into experience_connector values (1, 5173, 4287 5172);
    insert into experience_connector values (4288, 2, 5174, 5173);
    insert into experience_connector values (2, 5175, 4289 5174);

    When you run these queries:

    Select parent_experience_node_id
    of experience_connector
    where experience_node_id = 5175;

    Select parent_experience_node_id
    of experience_connector
    where experience_node_id = 5174;

    Select parent_experience_node_id
    of experience_connector
    where experience_node_id = 5173;

    Select parent_experience_node_id
    of experience_connector
    where experience_node_id = 5172;

    gives 5174, 5173 and 5172 and null. exp_node_type_id = 1 and exp_node_conn_type_id = 1 indicates that it is at the root. Hope my explanation is useful. Is what I'm trying to get - to get the big concession to 5175 grandparent who is 5172. Is it possible to do it with SQL?

    Thank you very much for you help.

    Best,
    Lacombe

    user6773 wrote:

    We don't know if the level. There could be any number of levels. Is there any other way around? Thank you once again.

    Well, you say that you need to root, not great great grandparent? If so, use:

    SQL> select  parent_exp_node
      2    from  experience_connector
      3    where connect_by_isleaf = 1
      4    start with exp_node_id = 5175
      5    connect by exp_node_id = prior parent_exp_node
      6  /
    
    PARENT_EXP_NODE
    ---------------
               5172
    
    SQL> 
    

    SY.

  • create the cookie using pl sql and retrieve values

    Hello
    I am currently in an urgent need to create cookies to BE oracle and also read the values of the. I tried to use code below. his display error
    code
    DECLARE
    ourcookie owa_cookie.cookie;
    BEGIN
    ourCookie: = owa_cookie.get('SESSION2');
    END;
    /

    BEGIN

    owa_util.mime_header ("text/html", FALSE ");

    -Create a cookie
    (owa_cookie). Send
    name = > 'SESSION. "
    value = > '344444',.
    expires = > sysdate + 2,.
    path = > ' / ');


    owa_util.http_header_close;

    EXCEPTION
    WHEN OTHER THEN NULL;

    END;


    But when I'm reading the cookie that I created, I am unable to exercise

    -It's for reading cookies
    DECLARE
    ourcookie owa_cookie.cookie;
    BEGIN
    ourCookie: = owa_cookie.get('SESSION2');
    END;
    /

    error:
    ORA-06502: PL/SQL: digital error or value
    ORA-06512: at "SYS." OWA_UTIL", line 325
    ORA-06512: at "SYS." OWA_COOKIE', line 36
    ORA-06512: at "SYS." OWA_COOKIE', line 140
    ORA-06512: at line 4 level

    842106 wrote:

    Now according to the guidelines of your comment, I created a simple OWA environment and run the code below. Now I get not found error of data

    ORA-01403: no data found
    ORA-06512: at line 23

    The error is caused the cookie is not found.

    The following is not valid - as there is no browser to receive the cookie:

    (owa_cookie). Send
    name-online "SESSION1"
    value-online '344433',
    expires => it sysdate + 2,.
    => path ' / '.
    );

    The following code must set the CGI environment - and add the cookie to the environment for the following code to read (as shown in the code example that I posted in the 2nd thread I talked to you):

    / * Initialization * /.
    OWA.cgi_var_name (1): = 'something ';
    OWA.cgi_var_val (1): = "other";
    OWA.init_cgi_env (1, owa.cgi_var_name, owa.cgi_var_val);
    / * End initialization * /.

    Of course, the following code will fail with a NO_DATA_FOUND there is no cookie.

    ourCookie: = owa_cookie.get('SESSION1');
    v_session: = ourCookie.vals (1);

    So it is not possible to create a true cookie and retrieve the value of CGI environment or apex not?

    Yes. But the web browser is non-existent. Then, you need create the CGI environment, which would have created the web server, before you call your allowed web code PL/SQL.

    In other words, if your initialization code of CGI should pretend that it is the web server, he received the call from web browser, it received the cookie (s) from the web browser - and now she needs to create the CGI (including cookies) environment for this web browser, and then call the procedure PL/SQL referenced by the browser in the URL, he argued.

  • Same link several times variable using dynamic SQL

    Salvation;
    I have a query that uses the variable even several times, is there a way I could just use that variable only once and it will take several times.
    Request is;
    run immediately "SELECT count (*) x WHERE MONTH_ID =: VOMNTH_ID"
    UNION
    SELECT count (*) FROM Y WHERE MONTH_ID =: VOMNTH_ID
    Union
    SELECT count (*) FROM WHERE MONTH_ID = z: VOMNTH_ID ' help months1, month1, months1
    What I don't want only once to provide months1.
    Your help is appreciated.
    PKM
    execute immediate
      'with p as (select :vmonth_id pmon from dual)
    SELECT count(*) FROM x,p WHERE MONTH_ID = p.pmon
    UNION
    SELECT count(*) FROM Y,p WHERE MONTH_ID = p.pmon
    union
    SELECT count(*) FROM z,p WHERE MONTH_ID =p.pmon '
    using month1;
    

    HTH

    Nigel cordially

  • Assigning value Varibale Global using the SQL statement

    Hi OTN Experts.

    CREATE OR REPLACE PACKAGE start_discussion
    AS
    g_variable VARCHAR2(10)  := (SELECT tag FROM fnd_lookup_values WHERE lookup_type = 'LEDGER No. 1')
    PROCEDURE start_procedure_one
    IS
    BEGIN
    SELECT * FROM start_table_one
    WHERE code = g_variable
    .
    
    .
    .
    
    PROCEDURE start_procedure_two
    IS
    BEGIN
    SELECT * FROM start_table_two
    WHERE code = g_variable
    .
    
    .
    
    .
    PROCEDURE start_procedure_three
    IS
    BEGIN
    SELECT * FROM start_table_three
    WHERE code = g_variable
    
    

    Kindly inviting you to watch above code and advise if I can use this kind of functionality in oracle.

    I tried but its gives error below when compiling the code.

    DECLARE
      v_value VARCHAR2(40) :=
      (SELECT tag
      FROM fnd_lookup_values
      WHERE lookup_type = 'LEDGER'
      );
    BEGIN
      dbms_ouput_.put_line(v_value);
    END;
    /
    
    
    PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
    

    Kind regards

    Shivaya

    Well, kind of, but not really.

    Who compiles or the other.

    something like this maybe:

    create or replace package foo

    as

    procedure start_procedure_1;

    end;

    /

    create or replace package body foo

    as

    g_variable varchar2 (10);

    procedure start_procedure_1 is

    Start

    null; / * put what here * /.

    end start_procedure_1;

    Start

    Select to_char (sysdate, 'yyyy') in the double g_variable;

    end foo;

    /

  • False values of voltage using NI 9225 and ELectrical Power Suite 2014

    Hi all

    I have a few problems regarding the use of a map of analog voltage NI 9225 with code exaple quality Applications of power (cRIO) (Delta-Sigma) of the Electrical Power after 2014. Running the example code I values of voltage wrong, they are exactly doubled! For exaple with a 230 V RMS input I get 460 V RMS. I think the problem is the module, because by default, the code example expects to use a module NI 9242. Before the upgrade to LabView 2014, everything worked perfectly with EPS 2013. Am I something missung? I configured the C module in the project manager in the same way that I used with EPS 2013. Can someone help me? Thank you

    Gianluca

    Hi Gianluca,

    If you use other types of modules in the example, you must take care of the conversion of accuracy in the FPGA VI.

    As FPGA VI resampling takes the signal of type fixed point +-24.1, you convert the +-24,10 and-24,5 to 24.1 in the Data Acquisition loop before feeding to the FPGA VI resampling.

    And in the loop of data Communication, you restore the output of +-32,3 to 32,12 - signal + and +-32.7. Notice at the time the zoom in and zoom out are equal.

    If you change other types of modules of different precision, you must change the precision of the given thread.

    For example, 9244 accuracy is +-24.11, so when you convert it to +-24.1, you must restore it by variation of-32,3 to-32,13.

    Please refer to the screenshot:

  • How can I set the time_zone if I use a templete and DBCA to create my database

    Hello

    It is possible to set the time with the SET TIME_ZONE section of the CREATE DATABASE statement.

    But how do I do this if I create the database from a model of DBCA?

    Kind regards

    You can do after you create the database by using alter database set time_zone.

  • How to set up a network home using xp pro and vista?

    Have 2 computers on 1 on VISTA & XP . I want to share 3 different printers & somes files on the home network. Thank you for any suggestions.

    Hello

    Take a look at this...

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_xp-networking/is-it-possible-to-connect-the-new-Windows-7/73be1d8f-7367-4a0c-A747-d3e1922c7d2e

    .. .and see if it helps. The same principles apply to Vista.

    If you are having specific problems please after return, I'll be watching!

    Please mark this as useful or response if applicable.

    Tricky

  • Help with dynamic Action with pl/sql and Javascript

    Hi all
    I'm a little hard with the following and I was wondering if someone can help me.
    My test app is here:
    http://apex.oracle.com/pls/apex/f?p=32581
    
    workspace: Leppard
    Login: guest
    pw: app_1000
    
    Tab: DB Link (page 19)
    I have a list of unique selection on the page that queries a table in my diagram.

    This is the flow that works, but not the user experience I want:
    User clicks on the button Create Page 19 > the next page, page 20, appears as a popup window > user enters the name of the link = "MyLink" (or other) and one unit number, i.e. 1234 (or other) > user clicks 'Create using process' button > success message > user closed the window to return to the page 19 > user clicks LOV refresh to refresh the list of selection so that the new value is displayed.

    That's what I'm aiming for: user clicks on the button Create Page 19 > the next page, page 20, appears as a popup window > user enters the name of the link = "MyLink" (or other) and one unit number, i.e. 1234 (or other) > user clicks button "create using the DA ' > dynamic action is called running pl/sql closes the popup window and refreshes the list of selection on page 19.

    I know that I have some problems with my dynamic action. First of all, the pl/sql is not yet recognize the values that I enter the fields in item on page 20. I created a first pl/sql "null;" to force these items in session state, but it does not work for me and the pl/sql just inserts a null value into my table. Secondly, I can't get javascript to fire code to refresh the list of selection on page 19. The code I use in the DA is the same thing as what is behind the button refresh LOV, so I am confident that the code works, I just can't get this fire click the button "create using the DA" on page 20.

    Sorry if this is confusing - I can clarify if necessary, let me know. Thanks in advance. Of course I'm still learning...

    John

    Published by: John K. on May 30, 2013 19:28

    I modified your DA as follows.

    In real Action of DA,.

    1 Seq 10, I added the element page 20 Page points to submit and return Pagenames. You forgot to add items here
    2 Seq 20, I changed your simple code to insert. Simple code just insert
    3 Seq 30, I added the new code to close the window and reload the window open.

    Thank you
    Lacombe

  • Open a read-only text field using the button and javascript

    Hello

    I have a form with text fields that I préremplira data. The text fields will be in read-only by default. I want to ensure that when a user wants to make changes, he will need to click on a button and in turn, background of the text field will become gray and he can make changes to the text field. I can already do gray running in background, but I can't make the text box open.

    This is the code that will run after the button is clicked:

    color.ltGray = new Array ("G", 0.75);

    this.getField('TestField').fillColor = color.ltGray;

    this.getField('TestField').access = "open";

    Background of the text box becomes gray, but it is always read-only. Any ideas?

    Thanks in advance!

    If you have created the form in Acrobat (as opposed to LiveCycle Designer), change the last line to:

    this.getField('TestField').readonly = false;

  • Using of the dynamic SQL and the cursor in a procedure

    Here is the procedure:
    create or replace
    Procedure type_paiement_total
    is
    
        cursor xbtable is select table_name from user_tables where table_name like 'XB%';
        n_table user_tables.table_name%type;
        req     varchar2(256);
        journal varchar2(2);
        mois varchar2(2);
        an varchar2(2);
      begin
        for n_table in xbtable
        loop
          execute immediate 'insert into xx_jk_xb (
          clie_code,journal, periode,origine, xb_ecri,xb_libe  ,dos_code,xb_debi,xb_cred,xb_term
    )
    select c.code,  
    substr(:1,3,2),
    substr(:1,7,2)||substr(:1,5,2)||,
    :1,  
    xb.ecri,  
    xb.libe,  
    d.code,
    xb.debi,
    xb.cred,
    xb.terme
    from                      
    '||n_table.table_name ||' xb,
    dossier d,                      
    client c                    
    where xb.cmpt=''4111''                    
    and xb.doss  =d.code                    
    and c.code   =d.clie
    and c.role=''1''' using n_table.table_name;
          execute immediate 'insert into xx_jk_logxb (recnum,xb_ref,trsf) values (seq_logmreg.nextval,:1,''OK'')' using n_table.table_name;
          commit;
          fetch xbtable into n_table;
        end loop;
      end;
    What he does (or what I intend to do)
    take the datas of a whole bunch of pictures and put them in the "XX_JK_XB" table and make a log of the tables covered in xx_jk_logxb give just the source table and the status (OK).
    Now when I run the procedure I get a "missing expression" th ' immediate «insert into xx_jk...»» »

    I just can't tell what is the problem here.

    clues?

    Seems to me that you are wrong assuming that the binding can be done by name and no position when you use immediate enforcement.

    Example:

    SQL> create table foo_tab( c1 varchar2(10), n1 number );
    
    Table created.
    
    SQL>
    SQL> begin
      2          for i in 1..10
      3          loop
      4                  execute immediate 'insert into foo_tab values( to_char(:1), :1 )' using i;
      5          end loop;
      6          commit;
      7  end;
      8  /
    begin
    *
    ERROR at line 1:
    ORA-01008: not all variables bound
    ORA-06512: at line 4
    
    SQL>
    SQL>
    SQL> begin
      2          for i in 1..10
      3          loop
      4                  execute immediate 'insert into foo_tab values( to_char(:1), :1 )' using i,i;
      5          end loop;
      6          commit;
      7  end;
      8  /
    
    PL/SQL procedure successfully completed.
    
    SQL>
    

    As you can see, 1 PL/SQL block attempts to re - use bind variable: 1 new - and only link once.

    Fact does not work like that - you must link it again. Binding is done by bind - 1 position = 1 to the help of var, 2nd = 2nd bind using var, etc.. Name of the connection variable used is irrelevant and not unique.

  • Tutorials for HTML 5 and Javascript to use APEX 5

    Hi guys,.

    Ask any good ebook or online tutorial where I can learn how to use HTML 5 and Javascript with APEX 5.

    Thank you

    Hi edy12,

    edy12 wrote:

    Ask any good ebook or online tutorial where I can learn how to use HTML 5 and Javascript with APEX 5.

    HTML5 is already used in some of the themes in Oracle APEX 5. (namely HTML5 themes introduced in APEX 4.2 + universal theme in APEX 5.0)

    Learning HTML5 and JavaScript, there are a lot of online resources like this:

    Also, you will find good books for HTML5 and JavaScript. In addition, having learned HTML and JS, you can navigate on jQuery and CSS tutorials like these two are also needed to develop applications APEX 5. As these (HTML, JavaScript, jQuery and CSS) are web development of basic technologies, learn which will give you good understanding about the structure and behavior of the HTML page and edge to customize themes and templates in your APEX application.

    Kind regards

    Kiran

Maybe you are looking for

  • ICloud can save new files iPhone only?

    I recently had an iPhone and uploaded photos from all the previous ones of my phone. These files are already saved and I want to stay on the iPhone, because the phone has a lot of memory (I do not need them in iCloud). Now I take new pictures/videos

  • TouchPad does not scroll with Win 7 on Satellite A200 PSAE3E

    Hello I have a little problem with the touchpad after update my OS for Win7 (x 86 32-bit).Scrolling with the latest drivers for Win7 from Toshiba and Synaptics does not work well. 14.0.3.0 driver version (2009-08-27) Toshiba A200 PSAE3E Does anyone h

  • Satellite Pro L670-16Z and WinXP - keyboard Fn + F8 does not work

    I installed Windows XP on this laptop. The keyboard * Fn + F8 * (control of the wireless switch) do not work. ?Any idea? Thank you

  • HP15: "enter password administrator or power on password

    Hello! Can you help me. Laptop is stuck on this screen. The key that I receive after you have entered the wrong password 3 times is 51397352. Thank you!

  • 2550PS LaserJet won't print

    Please do not laugh at the age of my printer. It does everything but print. Have tried all the instructions in this enormous amount of info provided with the printer but nothing helps. Drum does not turn to that can be the problem. Anyone had any exp