How to execute a query in javascript

i have to give alert("record exists"),if the record alredy exists in the database.how to do it, by executing a query in javascript. please suggest me something with example

You cant use Javascript itself for queries
The query will be done in your java code .
Easiest soloution is to simply submityour page and have it display the exist warning as response.
More complex answer is to use XMlHttprequest to do the query in the background and have it eventually display the warning

Similar Messages

  • How to execute SQL Query in Code behind Using infopath 2010?

    Hi,
    I've repeatable on infopath form, and want bind it throuth code behind from SQL table. My question is that how to execute SQL Query in code behind from infopath as well as how would get Query result to bind repeatable control?
    Thanks In Advance
    Shoeb Ahmad

    Hello,
    You first need to add new SQL DB connection then you need execute connection from code behind.
    See below link to create new connection
    http://office.microsoft.com/en-in/infopath-help/add-a-data-connection-to-a-microsoft-sql-server-database-HP010092823.aspx:
    http://www.bizsupportonline.net/infopath2010/connect-infopath-2010-sql-server-2008-table.htm
    Then use below code to execute this connection:
    AdoQueryConnection conn = (AdoQueryConnection)(this.DataConnections["Data connection name"]);
    string origCommand = Select * from tablename;
    conn.Command = origCommand;
    conn.Execute();
    Finally bind your table:
    http://www.bizsupportonline.net/infopath2007/4-way-programmatically-add-row-repeating-table.htm
    http://stevemannspath.blogspot.in/2010/09/infopath-20072010-populate-repeating.html
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How to execute the valuechangelistener thru javascript ?

    Hi,
    JDev 11.1.1.6
    How to execute the valuechangelistener thru javascript ?
    Regards,
    Gopi

    we need to use ClientListener and ServerListener for calling the method.
    please refer the below threads, these includes the code.
    how to call backing bean method from java script
    Calling the Managed bean class method from javascript on page load
    regards,
    Rajan

  • How to execute a query than open a popup?

    Hi,
    We created a custom OA module. This module has buttons on it. Those buttons generates events. Depending on each event, I should execute a query, transform the result in a xml than open a popup and pass the xml content to the jsp page that was opened.
    what have I done so far:
    - Threat the events generated by the buttons - That is being done on the processFormRequest in the CO;
    - The CO has to call a AM method to execute a query. That is not done but it is easy to do it;
    - The "resultset" of the query has to be transformed to a xml. If some one can give me a clue how to do it would be nice;
    - Finally, in the CO with the xml, open a popup passing the xml. How can this be done?.
    thanks,
    Marcelo

    - The "resultset" of the query has to be transformed to a xml. If some one can give me a clue how to do it would be nice;
    You can get the VO resultset as XML using writeXML method in VOImpl.- Finally, in the CO with the xml, open a popup passing the xml. How can this be done?.
    Is the new page being opened a OAF page ? if yes then you can just retain the AM when you go to the new page and you will have the VO with the data in it, you can then use the VO as is or write the XML from the VO data.If , on the other hand, your new page is not a OAF page and is a simple jsp, then
    I dont think it is a good idea to pass the entire resultset as a XML to the target page, instead, you can just popup the page on press of the button and execute and generate the XML in the target page.
    Thanks,
    Tapash

  • Please help on how Bex execute the query designed in query designer.

    Hi All,
    Want to know how bex execute/interpret  the query when the query is execute in analyzer.
    I mean which part of the query is executed first, like  filter,RKF or CKF etc.
    Want to do step by step analysis .Please suggest on this.
    Thanks & Regards
    Sameer Khan

    HI,
    When u execute the query...It will fetch the Global filters data first ....means filters on Default values....then restrictions on Char Restriction pannnel....Then calculate the RKF and CKF,s....Conditions and Exeptions etc.......
    Thanks

  • How to execute sql query stored in  a variable

    Hi
    define query = 'select * from abc;'
    then how to execute this defined variable query.
    Thanks,
    Shyam

    EXECUTE IMMEDIATE mmy_sql --(variable
    INTO     mmy_default_bill_type;
    by kumar.

  • How to execute the query from different blocks in Forms

    Hi,
    Curently I have a case where I need to execute the query from some other block. I used
    l_curr_item VARCHAR2(62) := :SYSTEM.CURSOR_ITEM;
    Go_Block ('BLOCK2');
    Execute_Query;
    Go_Item(l_curr_item);
    This works fine , but as I am using Go_Block it does some other activities related to that block, which I dont want them to get executed.
    So can any one please suggest me how I can call the query alone without using the Go_Block .
    Thank you.

    you can set global variable and filter for this variable in the triggers of blocks the actions then you avoid the code of trigger and you can use go_block

  • How to Execute  sql query in PL/SQL ( a variable) with out using Cursor or REF cursor

    Hi
    I am building a dynamic query based on some conditions
    as an example
    v_query varchar2(2000);
    x1 varchar2(20);
    y1 varchar2(20);
    z1 varchar2(20);
    v_query := ' Select x,y,z into x1,y1,z1 From ... ';
    Is there any way to execute the query with out using cursor or ref cursor..
    Thanks
    Arun

    Both Tod and Eric provided valid responses given the format of the queory you supplied. Howver, if you want to use dynamic sql in either way, you need to be absolutely certain that your query will always only return a single row (e.g. SELECT COUNT(*) FROM mytable), because if it retuns more than one, your procedure will break unless you have an exception handler to handle either TOO_MANY_ROWS or OTHERS.
    If you want to pull in a lot of data without walking a cursor, you should look at the BULK COLLECT options.

  • How to execute ABAP QUERY.

    Hi all,
            I know how to create ABAP QUERY using transactions SQ01,SQ02 and SQ03.But after creating it how to and where to use it.
    Rgds,
    Tkp

    Hi,
      Check this link..
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdf
    Thanks,
    Naren

  • How to execute a query when pressing a button

    hi,
    i created a frame (ADF Swing).
    in this frame i have a textfield, a button and a jtable.
    i want when i press on the button i execute a query which has a condition in the textfield and i want that the result will be shown in the jtable.
    thanks for help.

    Hello,
    I would test the record status of the first record in the block. If this status is 'NEW', then there is no record retrieved, so that you can exit the query mode with exit_form()
    Francois

  • How to execute the query for a block based on the parameter

    Hi All,
    Good evening.
    i have requirement where i need to display the data in one block based on the selected items.
    the scenario is like this...there are 2 LOV's and one apply button and one external region on the form.
    so when u select the lov values and click on apply button the query should execute based on this 2 lov values.
    i am not getting how to achieve this..i am very new to oracle forms..
    Please Help..
    Thanks
    Bharat
    please help..it is urgent..
    thanks
    bharat
    Edited by: Bharat on Jan 31, 2012 5:19 AM

    Bharat wrote:
    Hi All,
    Good evening.
    i have requirement where i need to display the data in one block based on the selected items.
    the scenario is like this...there are 2 LOV's and one apply button and one external region on the form.
    so when u select the lov values and click on apply button the query should execute based on this 2 lov values.
    i am not getting how to achieve this..i am very new to oracle forms..Another way you can do this. Create a lov and don't assign it to any column just one return item (should be id).
    Now create a button may be your "apply button" write two trigger when-button-press and when-mouse-click.
    at When -Button-Press trigger, change the block state to 'ENTER-QUERY' and at when-mouse-click show the LOV and then write execute_query.
    Hope this will help you.
    If someone's response is helpful or correct, please mark it accordingly.

  • How to execute a Query which exceeds 32K size?

    My Stored Procedure has one o/p parameter of REF CURSOR type. Based on the inputs,i'm forming the dynamic query which exceeds 32k size in length. So when i'm executing the proc it throws error.
    How can i execute the procedure contains dynamic query(>32k size) and get the result set through REF CURSOR type o/p parameter?
    I heared that it's possible through DBMS_SQL.PARSE() procedure. If it so, explain me in detail.
    Thanks!

    http://htmldb.oracle.com/pls/otn/f?p=2853:4:9265445064393730839::NO::P4_QA_ID:401

  • How to execute remote query by Oracle Database Link

    I use Oracle Database Link to query data from SQL Server. The query is like:
    select *
    from tableA@DL_SqlServer a
    join tableB@DL_SqlServer b
    on a.ID = b.ID*
    tableA and tableB is large and the result is relatively small. This query executes quickly in SQL Server since indexes are built both on the two tables. But it is very slow on Oracle Database Link to SQL Server.
    I guess the join operation is performed on Oracle side not on SQL Server side, thus the indexes are not used. Since I just need the joined result, I prefer to perform the query entirely on SQL Server and get the small result only. But I have no privilege to create views on SQL Sevrer.
    I konw that using SQL Server's linked server and OPENQUERY function can achieve this goal. I wonder how to do this on Oracle Database Link. Thanks!

    DO NOT DO THIS....specifically:
    "select *
    from tableA@DL_SqlServer a
    join tableB@DL_SqlServer b
    on a.ID = b.ID*"
    You would be better off to do the following:
    create a Materialized View in Oracle and once/day (or as frequently as you feel necessary) pull the data from SQLServer and then do the join locally by creating MV as TABLEA_MV and TABLEB_MV and then have views that have the REALTABLEA and REALTABLEB names that point to these MVs. This can be done without recompiling or changing your code. Trust me, I have seen this sort of thing in the past that completely crippled an IBM mainframe using DB2 along with a major network segment by having this sort of join via DB links. You must understand the ramifications of your "design" and I can tell you for certain that it is a very BAD!!! idea... Fix this before you are issuing another command: "alter DBA update resume/CV;"
    The app went into production at 7AM. By 9:30AM, the mainframe had executed more than 10Billion I/O's. It took > 15hrs for the mainframe to recover once we shutdown the app and implemented the view/MV described above.
    I will leave it as an excercise for the OP to develop the syntax for this.
    Edited by: onedbguru on Feb 15, 2013 7:27 PM

  • How to execute this query correctly?

    Hi sir,
    i am using one query which i converted from sql to oracle but getting error.
    Error(4,3): PLS-00428: an INTO clause is expected in this SELECT statement
    here is my query:
    SELECT distinct pa.id Code, pa.Empcode Emp_ID, E.Emp_FirstName || ' ' || E.Emp_LastName Emp_Name, pa.WorkDate Date1 , pa.InPunch In_Punch , pa.OutPunch Out_Punch , pa.approve , ls.Leave_Status_text StatusText , NVL(pt.punchtype, 'Updated') punchtype FROM PunchForApproval pa JOIN Employee E ON e.Emp_ID = pa.Empcode LEFT JOIN Leave_status ls ON ls.Leave_Status_id = pa.approve LEFT JOIN punchtype pt ON pt.id = pa.STATUS
    WHERE E.Emp_ID IN ( SELECT Emp_id FROM employees)ORDER BY pa.id DESC ;
    thanks

    This is the forum for the SQL Developer tool, Not for general SQL/PLSQL questions. Please close this thread and repost in the PL/SQL forum.
    PL/SQL doesn't work like TSQL. If you have a query within a PL/SQL block, you must fetch it INTO something ( a record or a set of scalar variables ) for processing.

  • How to execute this query

    Dear All
    I want to find the month difference between two dates ,i tried but iam getting the result like jan -01,jan-02 that is if my date is below 15 then iam getting value as 1 if the date is greater than 15 then i am getting the value as 2. I am attaching the query for your reference please help me out as my entire summary is coming wrong. For 1 month i am getting two answers.
    SELECT TO_CHAR(DEL_DATE,'MON/YYYY') PERIOD,round(months_between(del_date,sysdate)) DIFFMON,
    SUM(CATEGORY) TOPS,SUM(CATEGORY1) BOTTOM,
    SUM(NVL(CATEGORY,0)+NVL(CATEGORY1,0)) TOTAL,DECODE(round(months_between(del_date,sysdate)),0,'100%',1,'100%',
    2,'90%',3,'80%',4,'70%',5,'60%',6,'50%',7,'30%',8,'20%',9,'10%',10,'10%',11,'10%',12,'10%') PERC
    FROM ORDER_CONFIRMATION ,ORDER_PROJECTION
    WHERE TO_CHAR(DEL_DATE,'MON/YYYY')=TO_CHAR(PROJ_MTH_YR ,'MON/YYYY') AND
    TO_NUMBER(TO_CHAR(LAST_DAY(DEL_DATE),'MM')) - TO_NUMBER(TO_CHAR(LAST_DAY(SYSDATE),'MM')) IS NOT NULL
    GROUP BY TO_CHAR(DEL_DATE,'MON/YYYY'),round(months_between(del_date,sysdate))
    ,CAT_TOPS,CAT_BOTTOM
    ORDER BY DIFFMON,PERIOD
    Thanks
    V. Satish

    Satish
    Your query has two tables and you have given the defination for only one table.Please provide exact and correct table structure.Try to post create table statements and insert statements for the same.
    While posting do remember to write your sql statements inside {noformat}{noformat} tag
    So that when you write
    {noformat}select * from tab {noformat}
    It should appear asselect * from Thanks
    AJ                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for