Script to execute multiple select query

Hi,
What is the script to execute 5 ~ 15 select statement which will call pl sql functions simultaneously/concurrently and run it in sqlplus . I need to know the time taken by the queries to execute when there are multiple request calling the select statement.
Thanks.

I guess you can create 15 different shell scripts (on the server) which in turn call sqlplus and then call the 15 scripts in the background mode. Assuming your server is Unix, put an ampersand after your each shell script call to run in background.

Similar Messages

  • Daily morning 8 o clock , we need to execute a select query

    Hi,
    daily morning 8 o clock , we need to execute a select query.
    How we can do this using dbms_scheduler? or any other ways?
    db version : 10g
    Thanks,
    Kumar.
    Message was edited by:
    user548258

    Use daily and byhour parameters as shown in below link.
    http://www.dba-oracle.com/t_dbms_scheduler_examples.htm

  • How to execute multiple sql query in one time?

    HI
    I'm trying to convert my sql project In Oracle. In sql i could run multiple select statement/query in once and they return in multiple table result respectively. but in oracle its not executed.
    like:
    sqlQry := "Select * from abc; select * from qwe; select * from kkk; select * from xyz"
    its return 4 table abc, qwe,kkk,xyz to my dataset result
    how it is possible in oracle 10g

    Saten Chamoli wrote:
    I'm trying to convert my sql project In Oracle. In sql i could run multiple select statement/query in once and they return in multiple table result respectively. but in oracle its not executed.
    like:
    sqlQry := "Select * from abc; select * from qwe; select * from kkk; select * from xyz"
    its return 4 table abc, qwe,kkk,xyz to my dataset result That is pretty much a hack - there are no ANSI SQL standards supporting this syntax. It makes no sense either.
    If you want to combine 4 data sets, there are the UNION and UNION ALL set commands.
    If you want to create 4 cursors with a single call, then use the following (anonymous PL/SQL block) call:
    begin
      open :c1 for select * from abc;
      open :c2 for select * from qwe;
      open :c3 for select * from kkk;
      open :c4 for select * from xyz;
    end;Bind 4 client cursor variables to the ref cursors c1 to c4 and make the call to Oracle.
    And I suggest that you read up on Oracle concepts and fundamentals as your approach with you "sql project" shows ignorance in this regard.

  • How to execute SQL SELECT QUERY using VB in FDMEE

    Hi Experts,
    We are struggling with converting some of the FDM VB Scripts to FDMEE. While in FDM it was possible to simply create a RS Object, it doesnt seem to work in FDMEE. Can you please help me with some code samples that will help me execute SELECT Query and taking the output of the Query to Appropriate Variables.
    Also it seems that the Accelerators in erstwhile FDM are no longer available in FDMEE. So we have to re-write our entire code all over again
    Thanks

    There are plenty of code examples in the FDMEE guide and al of the API methods are documented for both Visual Basic and Jython. Personally, I think, if you are having to re-factor your code because you have migrated from FDM to FDMEE I would look at doing it in Jython not the VB API. Jython is the scripting language that will be the mainstream choice going forward and athough the VB API is present to ease the move from FDM to FDMEE I wouldn't be sure how long it will be supported and you therefore may have to perform another code migration not too far down the line. Jython is a very powerful and easy to use if you spend a bit of time familiarizing yourself with the syntax and also opens up the opportunity to leverage the myriad of Java classes out there. Also all of your import scripts have to be in Jython with no VB alternative.
    One other piece of advice is do not try and replicate allyour old code line for line. Look at what you were trying to achieve, assess whether it is still relevant or can it be faciliated by the new extended out of the box constructs and functionality FDMEE offers over classic FDM.

  • Executing Multiple Select Queries in a Single attempt

    HI,
    I executed two select queries in a single statement execute. It is executing without any error. Hence there must be two resultset objects within that single statement.
    What the problem is that I m able to fetch the first resultset and its data, But I execute stmt.getMoreResults() to move to the next resultset, it returns false, which means there is no more results. I want to know what is the problem ?? (Record exist in the database for both queries)
    And How can I rertieve both the resultsets. ??
    Plz help me asap.
    For ur convenience I m posting the Java code also which I m trying.
    sql.delete(0, sql.length());
    sql.append("select FIRST_NAME , MIDDLE_NAME , LAST_NAME from USER_MASTER where USER_ID=4;");
    sql.append("select producttransaction_id, product_type from product_transaction where transaction_id=102 order by product_type desc");
    Statement stmt = con.createStatement();
    stmt.execute(sql.toString());
    int resultsetcount =1;
    ArrayList arrlist = new ArrayList();
    rs = stmt.getResultSet();
    if(rs !=null)
    if(rs.next())
    .........// logic here working properly
    //Now when I move to next resultset using the below statement
    //it returns false indicating that there r no more results.
    // Why this is so ?????
    boolean moreresultsets = stmt.getMoreResults();
    System.out.println("MoreResultsets::"+moreresultsets);
    if(moreresultsets)
    rs = stmt.getResultSet();          
    if(rs!=null)
    while(rs.next())
    //...Logic.......
         rs.close();
    Thanks

    I've never seen this used the way you are using it. In my experience the only way to do this would be to execute a single SQL statement that returns multiple result sets - you are trying to append two SQL statements.
    You could define an in-line procedure wrapping your two select statements, or you could define a stored procedure to do the same thing. Then (either way) use CallableStatement to execute the call to the procedure.

  • Can I retrieve data from a multiple select query?

    I recently have been able to consolidate many queries into one large one, or into large compound queries. I found an instance where I am using a select query in a for loop that may execute up to 400 times. I tried building a huge compound query, and using DB Tools Execute Query vi, followed by the DB Tools Fetch Recordset Data vi. The query executes at the database without an error, but the Fetch Recordset Data vi only returns the first instance. Is there a way to retrieve all the data without having to send up to 400 separate select queries?

    Sorry I didn't replt earlier, I was on vacation. The query I am using is to check serial numbers, and determine if they are all valid. The programs purpose is to define a serial number to a pre-existing part number. Our company makes inclinometers and accelerometers, and this entire series of LabVIEW programs is designed to automate the calibration and testing of these units. The part number definitions can contain 3 or 4 hundred parameters, so the database itself consistes of 44 tables with potentially several hundred columns per table. It is designed to not only provide definitions to every part number, but also to store all potential raw unit data to be calculated and formed into a report at any time. The logistics of getting that much data in and out of the database have forced me to do things more effeciently. The actual query in question is to take each serial number either manually entered, or automatically picked, and see if they already exist with the part number they are being defined as. If there are any duplicates, then the program will alert the operator that serial numbers x, y, and z for instance have already been asigned as the part number in question. Currently I run a simple query once for each serial number. This works, but there may be 200 serial numbers assigned. Also the serial numbers can contain upper or lower case letters. By making all the serial number letters into capitals, then into lower case, it could mean up to 400 individual queries going out over the LAN. This is a bandwidth hog, and time consuming. I started experimenting with compound queries. The actual query used is below.
    SELECT SERIALNO FROM "maintable" WHERE PARTNO = '475196-001' AND SERIALNO = '3000005';SELECT SERIALNO FROM "maintable" WHERE PARTNO = '475196-001' AND SERIALNO = '3000006';SELECT SERIALNO FROM "maintable" WHERE PARTNO = '475196-001' AND SERIALNO = '3000007';SELECT SERIALNO FROM "maintable" WHERE PARTNO = '475196-001' AND SERIALNO = '3000008';SELECT SERIALNO FROM "maintable" WHERE PARTNO = '475196-001' AND SERIALNO = '3000009'
    When I execute this query, SQL Server 2000 has no problem with it, but the DB Tools Fetch Recordset Data vi only returns the first match. I think my answer may lie with OR statements. Rather than sending what amounts to potentially dozens of individual queries, I should be able to chain them into one query with a lot of OR statements. As long as the OR statement is not an exclusive OR statement, I think it should work. I haven't tried it yet, and it may take some time to get the syntax right. The query is built in a for loop with the number of iterations equal to the number of serial numbers being defined. Once I get this working I will alter it to include both upper and lower case letters that can be included in the query. Any suggestiona of how the query should be structured would be most helpful, or another way to achieve what I am trying to accomplish.
    SciManStev

  • How to execute a select query stored in variable

    Hello  helpers ,
    I have some "select queries" stored in the database . Now I can derive this query in some variable . How do I execute this query from the variable .
    example :
    Data Query type char50 .
    QueryVar = 'Select MATNR from MBEW where BWKEY = '0001' . '
    How do I execute this Query stoored in variable QueryVar in ABAP program ?
    Thanks a lot for helping .
    Regards
    Shashank

    Shashank,
    It is also possible to use (column_syntax) and (dbtab_syntax) together with (cond_syntax) when using SELECT statements in ABAP. For more info on (column_syntax) and (dbtab_syntax) just have a quick look at ABAP Keyword documention on SELECT statement (hit F1 on SELECT then scroll down to Select->Select result->Select Columns....)
    So in your case, you need to separate out (split) the value in 'wa_itab-query' into other variables or append into separate internal tables using common keys etc. - then looping at those tables with the common key (READ TABLE WITH KEY....) use the following syntax at the time of triggering the SELECT query:
    SELECT (column_syntax)
           FROM (dbtab_syntax)
           WHERE (cond_syntax).
    Also worth a look at this example below:
    PARAMETERS: p_cityfr TYPE spfli-cityfrom,
                p_cityto TYPE spfli-cityto.
    DATA: BEGIN OF wa,
             fldate TYPE sflight-fldate,
             carrname TYPE scarr-carrname,
             connid   TYPE spfli-connid,
           END OF wa.
    DATA itab LIKE SORTED TABLE OF wa
                   WITH UNIQUE KEY fldate carrname connid.
    DATA: column_syntax TYPE string,
          dbtab_syntax TYPE string.
    column_syntax = `c~carrname p~connid f~fldate`.
    dbtab_syntax = `( ( scarr AS c `
      & ` INNER JOIN spfli AS p ON p~carrid  = c~carrid`
      & ` AND p~cityfrom = p_cityfr`
      & ` AND p~cityto   = p_cityto )`
      & ` INNER JOIN sflight AS f ON f~carrid = p~carrid `
      & ` AND f~connid = p~connid )`.
    SELECT (column_syntax)
           FROM (dbtab_syntax)
           INTO CORRESPONDING FIELDS OF TABLE itab.
    LOOP AT itab INTO wa.
      WRITE: / wa-fldate, wa-carrname, wa-connid.
    ENDLOOP.
    Hope this helps.
    Cheers,
    Sougata.

  • Bash function/script to execute multiple commands on same output

    Occasionally, I come across the need to pass the output of a single command to multiple others (without piping each to the next), so today, I wrote a [very] simple Bash script to accomplish the task.  Piping the output of a command to `tree' is much like piping it to `tee', except `tree' allows you to execute multiple commands on the same output, rather than only writing to log files:
    #!/bin/bash
    # tree -- pipes the output of one command to >= 1 other
    # Usage: command | tree 'command 1' 'command 2'
    doc=$( cat - )
    for arg in "$@"; do
    bash -c "${arg}" <<EOF
    ${doc}
    EOF
    done
    An example of its usage:
    $ echo -e "1 2 3\n4 5 6" | tree 'grep 1' 'grep 4' "grep 1 | tee grep.log | awk '{print \$2}'"
    1 2 3
    4 5 6
    2
    $ cat grep.log
    1 2 3
    Though not elaborate, the script gets the job done.
    Last edited by deltaecho (2009-03-10 20:34:01)

    Xyne wrote:
    You could always call it "the Ukrainian Pipe"
    (if you can't laugh at this, you either need to loosen up or make a point to follow (annual) current events)
    That was a good one

  • Shell Script- Force Quit Multiple Selections?

    https://discussions.apple.com/message/25279344#25279344
    Thanks to Red for providing this below as it works great for single applications, but if I throw in it multiple selections allowed
    how can I separate each selection for force quitting? I'm a total newb to shell script with a decent skill level in applescripting. I'd love to see how this an be implemented.
    set theItem to (choose from list theapps) as text
    if theItem is false then error -128 -- or exit repeat (Cancel)
    do shell script "killall " & quoted form of theItem

    set theItems to ((choose from list theapps with multiple selections allowed) as list)
    if (theItems as text) is "false" then
    else if (theItems as text) is not "false" then
              set results to (every item of theItems)
              repeat with eachItem in results
                        do shell script "killall " & quoted form of (eachItem as text)
              end repeat
    end if
    TW actually after comparing it looks very similar! The reason why I used the false statement as text is I kept getting:
      --> false
    end tell
    tell current application
      do shell script "killall 'false'"
      --> error "No matching processes belonging to you were found" number 1
    and it was my workaround that didn't return any error at all. Looking at it a bit more the false was returning that error because I had it "as list". Thanks again for helping me learn how to simplify the workflow some more!
    Message was edited by: CyX SenZe

  • How to i write a script that makes multiple selections in a pdf and exports them to excel?

    I have a large number of PDFs
    Not all the PDFs contain information we need. We want to be able to automate a script that extracts certain info from the PDFs and opens them in a certain format in excel.
    Acrobat allows me to make a single selection and export as excel.
    How do i export multiple parts to excel from the pdfs and ensure that the resulting excel is in a format that i can use without much fixing needed (e.g. merged cells)?

    This type of process can't really be done using JavaScript. You would need to read the contents of the file, word by word, decide (based on some logic) what data to extract, and then collect it and at the end export to a plain-text file. Not a simple process...

  • Execute Multiple "select" queries from a java program

    Hi,
    Please take time to see the code below.
    What my problem is:
    All the queries given will be executed one by one. So, if there is large data to be retrieved then each query will take so much of time.
    Is there any way that i can execute all the 3 queries simultaneously so that i can get quicker response time.
    Please send me the way to do it and any sample code if available
    Thanks.........
    public static void main(String argv[])
    float spr=0;
    float spr1=0;
    float spr2=0;
    int db_block_size=0;
    String query1;
    String query2;
    String query3;
    query1="select count(distinct(substr(dbms_rowid.rowid_to_Restricted(rowid,0),1,8))) from table1";
         query2="select count(distinct(substr(dbms_rowid.rowid_to_Restricted(rowid,0),1,8))) from table2";
         query3="select count(distinct(substr(dbms_rowid.rowid_to_Restricted(rowid,0),1,8))) from table3";
    Connection conn;
    Statement stmt;
    String name;
         try {
    Class.forName("com.inet.ora.OraDriver");
              catch(java.lang.ClassNotFoundException e)
                   System.err.print("ClassNotFoundException: ");
                   System.err.println(e.getMessage());
    try
         conn = DriverManager.getConnection("jdbc:inetora:135.112.22.51:1521:S","dacscan","mnc");
    stmt = conn.createStatement();
    ResultSet rset=stmt.executeQuery("select value from v$parameter where name='db_block_size' ");
    rset.next();
         db_block_size=rset.getInt(1);
    System.out.println(db_block_size);
         rset.close();
    rset=stmt.executeQuery(query1);
    rset.next();     
    spr=rset.getFloat(1);
              System.out.println (spr);
         rset.close();
    rset=stmt.executeQuery(query2);
    rset.next();
         spr2=rset.getFloat(1);
              System.out.println (spr2);
         rset.close();
    rset=stmt.executeQuery(query3);
    rset.next();
         spr3=rset.getFloat(1);
              System.out.println (spr3);
         rset.close();
    catch(SQLException ex)
                   System.err.println("SQLException: " + ex.getMessage());
                   ex.printStackTrace();
              }

    Is there any way that i can execute all the 3 queries simultaneously so that i can get quicker response time.
    Yes, you can execute queries #1 and #2 each in its own thread. Execute query #3 in the original thread. Then use Thread.join() to wait for each of the other two queries to finish.
    - Saish

  • ORA-01653 error while executing a select query over DBLINK

    Hi,
    We have a query that is running to extract some data from a remote DB over DBLINK.
    The query is failing by throwing the error "ORA-01653 -- Unable to extend.........".
    Is this a problem with the "temp" tablespace of local database or is this with the "temp" tablespace of remote DB.
    As far as my knowledge goes, I guess any statement , selecting data over dblink where the query is being fired actually in remote db over dblink uses the temp tablespace of that DB only and hence the problem should be with the temp tablespace of remote db only but I am not very sure about this.
    Is there any chance that it can be problem with "temp" tablespace of local DB from where the query is being fired over dblink.
    It would be really helpful if anyone can throw some light on this.
    Thanks

    The error stack will normally tell you if the exception is raised in the remote database.
    You might try using the driving_site hint (see performance guide) to push work to the remote site or pull it local. It all depends on your particular query and explain plan.
    Remember to use { code } (without the embedded spaces) tags to frame your code and explain plan so it remains formatted, if you post it here.

  • OpenSQLException while executing a select query

    Hi,
    I am attempting to code an SQL query in a servlet  and get the following exception:
    com.sap.sql.log.OpenSQLException:
    Below is the code snippet I am using:
    String weekStart = request.getParameter("weekStart");
    String weekEnd = request.getParameter("weekEnd");
    final Connection con = ConnectionManager.getConnection();
    Statement stmt = con.createStatement();
    String query = "select * from SCHEDULES where BUS_PARTNER_ID = '" + empID + "' and SCHED_DATE  >= '" + Date.valueOf(weekStart) + "' AND  SCHED_DATE  <= '" + Date.valueOf(weekStart) + "';";
    final ResultSet rs = stmt.executeQuery(query);
    The fromDate and toDate parameters are of type string and have format yyyy-mm-dd which is getting passed to the servlet .Values are like 2010-07-13 etc.Issue seems to be with the date beacuse query is working fine without date parameters.
    Can someone please tell me what I am doing wrong and how to fix it?
    thanks
    Reena

    Yes. I understand. Seems as if that's one of the reasons for the error. However, Note:401436.1 speaks on Bug fixes by problem type and listed IOT related bugs.

  • ORA-00600 errror while executing a select query.....!!!!

    Hi experts,
    Need ur kind help and suggestions....
    My DB is on 10.2.0.1.0.
    When I run the following query I am getting ORA-00600: internal error code, arguments: [qkagby.noexec], [], [], [], [], [], [], [] error.
    The table CUSTOMER_HISTORY is an Index Organized table.
    SELECT (CASE WHEN townname IS NULL THEN 'TOTAL' ELSE district END) DISTRCT ,
    TOWNNAME,(CASE WHEN WWWREVENUE<>'0' THEN NOSUBS ELSE 0 END ) "NO OF SUBS",WWWREVENUE FROM (SELECT district,TOWNNAME, COUNT(DISTINCT b.msisdn ) NOSUBS,NVL(SUM(REV),'0')
    WWWREVENUE FROM CUSTOMER_HISTORY a,(SELECT msisdn,SUM(USAGE)/100 REV FROM SERVICE_USAGE
    WHERE SERVICE='WWWUSAGE' GROUP BY msisdn) b
    WHERE a.msisdn=b.msisdn(+)
    GROUP BY CUBE(district,TOWNNAME)
    ORDER BY district)
    WHERE district IS NOT NULL
    ORDER BY townname;
    When I try running explain plan I am getting the same ORA-600 error..
    Please advice..
    Thanks in advance...
    Chotu.

    Yes. I understand. Seems as if that's one of the reasons for the error. However, Note:401436.1 speaks on Bug fixes by problem type and listed IOT related bugs.

  • Multiple Schema select Query problem

    Hi everyone,
    when I tried to execute a select query as following,
    select A.field1, B.field2 from S1.table1 A, S2.table2 B
    in a session bean, it gives an exception as follows
    " An illegal attempt to use multiple resources that have only one-phase capability has occurred within a global transaction"
    Can anyone pls help me in this regard.
    Thanking you
    D. Suresh Kumar

    This is the query i thought of executing
    SELECT * FROM SCH2.AP_TRANSACTION_EPS A, TRANSACTION_TYPES B WHERE C_FUND_CODE = '" + fundCode + "'AND D_TRADE_DATE = to_date('" + date + "','yyyy-mm-dd') AND A.C_TRANS_CODE = B.C_TRANS_CODE " + " AND B.C_TRANS_TYPE = '" + transType + "' ";
    where "fundCode", "date","transType" are java variables.
    The error message is
    [8/1/03 12:38:49:688 IST] 491a6a5 TransactionIm E WTRN0062E: An illegal attempt to use multiple resources that have only one-phase capability has occurred within a global transaction.
    [8/1/03 12:38:49:750 IST] 491a6a5 ConnectO A CONM6014I: Received exception (IllegalStateException) in method (enlist). Issuing new exception (IllegalTransactionStateException). The original exception's stack trace was: java.lang.IllegalStateException
    Thanking you

Maybe you are looking for

  • External HardDrive Compatible? help!

    Hi guys i intend to get an external enclosure and a normal harddrive and convert it to an external harddrive myself. I want to know what harddrive should i get and what would i need to do to make it compatible with both mac and pc? how should i forma

  • HT2729 apple mobile device service is not started

    I'm getting this error message when trying to sync my iphone  "cannot sync because apple mobile device service is not started" Does anyone know why that is or what I have to do to change it?

  • Find host and port

    My J2EE application has an EJB module and web module. I need to call the servlet in the web module from EJB module, via HTTPUrl connection. To make the web application portable and not-hardcoded, is there any way for EJB module to find out programati

  • Question Related To Dates

    Hi All, I have been knocked off by this strange situation. I will try to simplify and explain the problem at my best. We have DATE column in a table, the data ranging from 01-Jan-2009 to 31-12-2010. We have to calculate ISO_WEEKS based on the date co

  • Using .ico files in applications

    Does anyone know how I can create a put a .ico file in the top corner of my application?