How to run a sql query from a button in apex 3.0

Hi,
I am brand new and went through/installed the obe project tracker. I have need to create a simple application that displays a result (2 fields, name and license number) based on two parameters (dob and login id) which all are stored in 1 table in the database. I could this very simply in VB or VB.net but have no idea how to do it in apex.
Please provide guidance,
Thank you,
Tom

Hi Tom,
Sounds like a report region will satisfy your requirements.
Create a new report region on one of your pages.
Choose SQL Report and give the region a title.
When you get to the "Enter SQL Query or PL/SQL function returning a SQL Query:" step, type:
SELECT name, license_number
FROM   <insert_your_table_name_here>
WHERE  dob = :P<n>_dob
AND    login_id = :P<n>loginid(replace <n> with the page number that the region is on and use your own table name).
Don't try to run the page yet - it will give 'No data found'
Now, go back to the Page Definition screen and add two items in the region you just created - call them P<n>dob and P<n>login_id
Then, create a button in the same region (to be displayed amongst the region's items) - call it P<n>_GO and click 'Create' (take all the other defaults).
Now you can run the page, put some values into the fields and click go.
If you want to get fancier, you can change the text items to select lists etc. - let us know if you need help with that.
Hope this helps,
Bryan.

Similar Messages

  • How to run recordset SQL query in FORM DATA event

    How can I run recordset SQL query in FORM DATA event upon clicking on Add button in the document?

    Hi Slamet,
    When you receive a form data event you have a class containing inside it a ObjectKeys xml info regarding the object added/modified,...
    With the objects keys you can then use the DI API method called GetByKeys to obtain the DI Object.
    There is some information about it in the SDK Help file, mainly in the "FormDataEvent" class definition:
    <i>The event provides the unique ID (BusinessObjectInfo.ObjectKey) of the modified business object. You can use the value of this property as an input parameter in the DI API DataBrowser.GetByKeys method to get a DI object.</i>
    Pay attention you don't have this information in the Before=True event of the Add as it is not yet in the database.
    Hope it helps
    Trinidad.

  • How to run a BI query from SSM

    HI,
    My client would like to drill down to a BI query where the starting point is a KPI.
    For eg, we have a KPI "Turnover". When we are at kpi detailed level for a specific period, we would like to run a query to have detailed information for turnover (we dont want to use report functionnality of SSM).
    We are using SSM 7.5 and BW queries as data provider.
    Is there a way to achieve this ? (web service ? )
    Thanks in adavnce

    Jacques,
    You cannot run a BI Query from the end user interface of SSM. Your alternatives are to create an associated report inside SSM or use an Associated Link in the KPI Details section.
    Right above the graphing on the KPI detail page there is the link Create Associated Report. SSM has some template reports and allows users to put together a report based on available SSM data.
    There is also the possibility of using Associated Links on the KPI detail page to point the user via a url to another reporting application, though it would not bring that data with it.
    Regards,
    Bob

  • How to run a SQL query which is stored in a column using PL/SQL?

    Hello
    I have a table A and one of the column values is select * from emp where empno :=xyz;
    Now I would like to call this SQL query using a cursor in PL/SQL and run this for all the empno's and insert them into a temp table.
    Can anybody help me in writing this PL/SQL query?
    With Regards,
    Mohan

    user525114 wrote:
    The primary reason for doing this is we are calculating percentiles on an entity sales for different range periods, and there are several sql queries stored in a cloumn, so we would like to know whether we can run these queries by calling them in a pl/sql query, Its not necessary that we need to use a cursor, but once fetching the result set of the query we would like to insert them in a table.Vamsi,
    As said in response to Satya, executing dynamic SQL, looping over the result set and inserting the results one by one in a temporary table, is a horribly bad idea. Especially in terms of performance, but also regarding the maintainability of your code. It's just way more complex than necessary.
    If you want to calculate percentages, then use analytic or aggregate functions in SQL to do so. If you want to store them, use a single INSERT SELECT statement.
    If you want to continue on the same path, use Satya's code and use it inside a loop.
    Regards,
    Rob.

  • How to Run a .sql file from simple java class

    How to execute a .sql file consisting of Complex Queries,procedures through simple java class.
    The queries may have different delimiters,queries independant of each other.
    I am able to do with Specific De-limiter.But I need in such a way that there should not be any
    Constraints. Since My .sql may Contain different De-limiters.
    If any one can Suggest Some Solution.
    It will be Great Help.
    regards
    Anil

    Check out ibatis script runner, it' a third party library but quite handy for running sql files...
    m

  • How to retrieve generated sql query from interface using groovy

    Hi All,
    I'm new to odi and i need the generated sql query code from the interface using groovy.

    Hi All,
    I'm new to odi and i need the generated sql query code from the interface using groovy.

  • How to run a sql query (select) in parallel

    Hi All,
    I would like to do a select using the 8 cpus our production
    server has. My select is simple in just one table but its a big
    table (aprox. 10.000.000 rows) and I have to do a full scan in
    it. I know oracle does that, but how? do I put a clause in the
    select telling oracle to do the query in parallel? Has anyone
    done that, yet?
    Tks,
    Marcelo Lopes
    Rio de Janeiro - Brazil
    It's a hot sunny day today :)

    You could either include a parallel clause in the table
    definition or alter the tble to include parallelism, or put a hint
    on the SQL ..
    alter table my_table parallel (degree 16);
    or
    select /*+ parallel(my_table, 16) */ ...

  • How to run a delete query from JSC

    There is a simple way to run this:
    delete from some_table where condition
    this statement will delete from 0 to n rows, depending on condition.
    Regards.

    There is a simple way to run this:
    delete from some_table where condition
    this statement will delete from 0 to n rows,
    depending on condition.
    If you want to first
    select ... from some_table where condition
    then delete one or more of those rows, the
    "Accessing databases: Performing Inserts, Updates, and Deletes" tutorial has some hints.
    If you just want to just execute a statement , such as
    any delete or update, then just use standard JDBC.
    For example:
    // Obtain a connection
    InitialContext ctx = new InitialContext();
    DataSource ds = (DataSource) ctx.lookup("jdbc/<CreatorDataSourceName>");
    Connection conn = ds.getConnection();
    // make and execute the statement
    Statement stmt = conn.createStatement();
    stmt.execute("delete from xxx where ...");
    // find out how many rows were deleted.
    int rowsAffected = stmt.getUpdateCount() ;
    // Don't forget to close() in a finally clause!!!
    conn.close() ;

  • How to run a script A from a button "Button 1" ?

    Hi all, I've got this problem for having a window with several buttons named "Button 1" "Button 2"... and run the script "Script A" if we click on the button 1, the script "Script B" if we click on the button 2 etc...
    Here is my short script :
    #target indesign
    //make a table of contents which send directly to the right script
    var w=new Window("dialog");
    var buttongroup=w.add("group");
    var panel=buttongroup.add("panel");
    var button1=panel.add("button",undefined,"Script A");
    var button2=panel.add("button",undefined,"Script B");
    var button3=panel.add("button",undefined,"Script C");
    var cancel=buttongroup.add("button",undefined,"Cancel",{name:'cancel'});
    buttongroup.addEventListener('click',press)
    w.show();
    function press(e){
        if(e.target.type=="button"){
            if(e.target.text=="Script A"){
                //w.close();
                app.doScript(new File("c/scriptA.jsx"),ScriptLanguage.javascript);
            else if(e.target.text=="Script B"){
                app.doScript(new File("c/scriptB.jsx"),ScriptLanguage.javascript);
            else if(e.target.text=="Script C"){
                app.doScript(new File("c/scriptC.jsx"),ScriptLanguage.javascript);
    Each script A, B and C begins with an app.dialogs.add()
    And here is the problem, it tells me that an alert or a modal dialog is already active
    I tried the w.close() but it doesn't work...
    I don't think addEventListener is what I need, maybe I'm wrong for using a window but it's the only way to give names to the buttons, isn't it ?

    Now I get it... I work both on Mac and Windows but when I tried the 'palette' I forgot that I had only the version CS4 on Windows
    (and I launched the script from the ESTK instead of the script panel..mistake !!)
    Now it works great on the Mac, thank you Peter for the help and for the pdf scriptui

  • How to transport SQL Query from SQVI Tcode?

    Dear Friends,
    Can any one tell me how to transport SQL Query from <b>SQVI</b> Tcode.
    Full Points will be rewarded.
    Thanks & Reagrds
    Ravi

    go to sqvi tool .....
    select u r query name ......in the menubar ....quickview....> additianal functions.......>generate program
    after doing generate program ....go to again same menu path as i have mentioned above [quickview....> additianal functions.......>display report name it will give the report name of the select query ..........copy the report name and give it abap editor[se38] u will get u r query program......with all authority checks.....
    in start of selection event of u r program u will find u r select query.
    reward points if helpful

  • How to Run a Select Query  stored in a Variable

    Hello,
    I have a following requirement:
    Result of one select query on Var1 , result of other select query in Var2 ,
    if Va2 = 'value11' OR Var2 = 'Value2' then Var1 = 'select query'. Now how can I run this SQL query at the end of the Pl/SQL?
    so I'm writing following query for the same:
    DECLARE
    qry nvarchar2(500);
    result nvarchar2(500);
    BEGIN
    select 'select TEXTVAL as "CHARG" FROM TABLE1 WHERE LOC =''[ParameterValue]'' and KEYNAME =''<<REPLACE>>''' INTO qry from dual;
    SELECT CASE WHEN count(RW."CountofBATCH") > 1 then 'Mixing'
    WHEN count(RW."CountofMAT") = 0 then 'None'
    ELSE 'Other'
    END
    INTO result
    FROM TABLENAME2 TT, XMLTable('/Rowsets/Rowset/Row' PASSING TT.XMLCOL
    COLUMNS
    "CountofBATCH" PATH '/Row[CLABS > 0]/CHARG',
    "CountofMAT" PATH '/Row[MATNR = "[Parameter Value]"]/MAT'
    ) AS RW
    where
    TT.PL = '[Parameter Value]' and
    TT.TANK = '[Parametr Value]' ;
    IF result = 'Mixing' OR result = 'None' THEN
    qry := replace( qry , '<<REPLACE>> ' , result);
    else
    qry := 'Nothing';
    END IF;
    This way the variable qry will have select statement. Now How can I run this qry variable to get the output of that select statement in the same query?

    you can use execute immediate if the output of the query is in the single query.
    that is very simple.
    have the query in the signle string and then pass like this
    declare
    qry varchar2(255);
    result varcharf2(2500);
    vempid number :=1;
    begin
    qry:='select empname from emp where empid=:empid';
    execute immediate qry into result using vempid;
    -----now the data result is in result
    end;

  • How to tune past SQL query??

    Hi Team,
    Straight to issue --> I am seeing an query running for long time. When i begun to trace that particular query it got over by the time and now how to trace that specific SID and QUERY..
    I am working on 10.2.0.4 version DB..
    How to trace an sql query after its execution?? pls provide steps how to begin with..
    regards
    dkoracle

    dkoracle wrote:
    Hi Team,
    Straight to issue --> I am seeing an query running for long time. When i begun to trace that particular query it got over by the time and now how to trace that specific SID and QUERY..
    I am working on 10.2.0.4 version DB..
    How to trace an sql query after its execution?? pls provide steps how to begin with..Can not be done.
    ALTER SESSION SET SQL_TRACE=TRUE;
    -- run query again

  • How to view the sql query?

    hi,
      how to view the sql query formed from the xml structure in the receiver jdbc?

    You can view SAP Note at
    http://service.sap.com/notes
    But you require SMP login ID for this which you should get from your company. The content of the notes are as follows:
    Reason and Prerequisites
    You are looking for additional parameter settings. There are two possible reasons why a feature is available via the "additional parameters" table in the "advanced mode" section of the configuration, but not as documented parameter in the configuration UI itself:
    Category 1: The parameter has been introduced for a patch or a SP upgrade where no UI upgrade and/or documentation upgrade was possible. In this case, the parameter will be moved to the UI and the documentation as soon as possible. The parameter in the "additional parameters" table will be deprecated after this move, but still be working. The parameter belongs to the supported adapter functionality and can be used in all, also productive, scenarios.
    Category 2. The parameter has been introduced for testing purposes, proof-of-concept scenarios, as workaround or as pre-released functionality. In this case, the parameter may or may not be moved to the UI and documentation, and the functionality may be changed, replaced or removed. For this parameter category there is no guaranteed support and usage in productive scenarios is not supported.
    When you want to use a parameter documented here, please be aware to which category it belongs!
    Solution
    The following list shows all available parameters of category 1 or 2. Please note:
    Parameter names are always case-sensitive! Parameter values may be case-sensitive, this is documented for each parameter.
    Parameter names and values as documented below must be used always without quotaton marks ("), if not explicitly stated otherwise.
    The default value of a parameter is always chosen that it does not change the standard functionality
    JDBC Receiver Adapter Parameters
    1. Parameter name: "logSQLStatement"
                  Parameter type: boolean
                  Parameter value: true for any string value, false only for empty string
                  Parameter value default: false (empty String)
                  Available with: SP9
                  Category: 2
                  Description:
                  When implementing a scenario with the JDBC receiver adapter, it may be helpful to see which SQL statement is generated by the JDBC adapter from the XI message content for error analysis. Before SP9, this can only be found in the trace of the JDBC adapter if trace level DEBUG is activated. With SP9, the generated SQL statement will be shown in the details page (audit protocol) of the message monitor for each message directly.
                  This should be used only during the test phase and not in productive scenarios.
    Regards,
    Prateek

  • How to write a SQL query in SAP B1 2007 B with input parameters?

    How to write a SQL query in SAP B1 2007 B with input parameters, on execution of which will ask for some input value from the user and the values will be selected from a list such as item list?

    The syntax like
    SELECT * FROM OITM T0 WHERE T0.ItemCode = '[%0\]'
    Thanks,
    Gordon

  • How to execute an SQL query present in a string inside an ABAP program?

    hello,
    How to execute an SQL query present in a string inside an ABAP program

    Raut,
    You can execute Native SQl statements.
    Ex: To use a Native SQL statement, you must precede it with the EXEC SQL statement, and follow it with the ENDEXEC statement as follows:
    EXEC SQL [PERFORMING <form>].
      <Native SQL statement>
    ENDEXEC.
    There is no period after Native SQL statements. Furthermore, using inverted commas (") or an asterisk (*) at the beginning of a line in a native SQL statement does not introduce a comment as it would in normal ABAP syntax. You need to know whether table and field names are case-sensitive in your chosen database.
    In Native SQL statements, the data is transported between the database table and the ABAP program using host variables. These are declared in the ABAP program, and preceded in the Native SQL statement by a colon (:). You can use elementary structures as host variables. Exceptionally, structures in an INTO clause are treated as though all of their fields were listed individually.
    If the selection in a Native SQL SELECT statement is a table, you can pass it to ABAP line by line using the PERFORMING addition. The program calls a subroutine <form> for each line read. You can process the data further within the subroutine.
    As in Open SQL, after the ENDEXEC statement, SY-DBCNT contains the number of lines processed. In nearly all cases, SY-SUBRC contains the value 0 after the ENDEXEC statement. Cursor operations form an exception: After FETCH, SY-SUBRC is 4 if no more records could be read. This also applies when you read a result set using EXEC SQL PERFORMING.
    EXEC SQL PERFORMING loop_output.
      SELECT connid, cityfrom, cityto
      INTO   :wa
      FROM   spfli
      WHERE  carrid = :c1
    ENDEXEC.
    Pls. Mark If useful

Maybe you are looking for