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) */ ...

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 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.

  • 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 get an sql query result to a textbox?

    i am working with jdk1.4 and office 2003.
    i need to run the following SQL Query: "SELECT max(BookId) as BookId FROM Books" where BookId is an autonumeric generated number obtained from the field autonumber in access 2003 database.
    now, the result of this must be placed in a textbox.
    does anyone knows how to do this?
    I ve tried this but nothing happens and niether any error comes
    st = con.createStatement ();     //Creating Statement Object.
    long bookNo;          //Use for Comparing the Book's Id.
    try {     //SELECT Query to Retrieved the Record.
    String q = "SELECT max(BookId) as BookId FROM Books";
    ResultSet rs = st.executeQuery (q);     //Executing the Query.
    bookNo = rs.getLong ("BookId");          //Storing the Record.
    bookNo =(bookNo+1);
    txtBookId.setText (""+bookNo);
    catch (SQLException sqlex) { }
    does anyone knows how to do this?????plz help me out.
    Thanks
    Aanchal

    Hi Aanchal,
    If an SQL error occurs now, you cannot see it in your code. You should do something with the exception you catch, e.g. printing it: sqlex.printStackTrace(), so that you can see if something goes wrong.
    For your number, you should move the cursor in the resultset to the first row - either by: calling first( ) or next ( ), then you can retrieve your booknumber.
    Best Regards,
    Martijn

  • When I run my SQL query in MS Access it ask for value ...I don't know why

    Hi,
    Below is my SQL Query:
    SELECT employee.Name, employee.Emplid, payudds.Udds, data.Budget, data.Fund, data.FTE, data.[Annualized Rate], data.[FN Dist Pct], data.Udds, data.Project, data.[Empl Class]
    FROM ((employeeuddslink INNER JOIN employee ON employeeuddslink.[employee_ID] = employee.[ID]) INNER JOIN payudds ON employeeuddslink.[payudds_ID] = payudds.[ID]) INNER JOIN data ON employee.[Emplid] = data.[Emplid]
    GROUP BY employee.Name, employee.Emplid, payudds.Udds, data.Budget, data.Fund, data.FTE, data.[Annualized Rate], data.[FN Dist Pct], data.Udds, data.Project, data.[Empl Class], employeeuddslink.employee_ID, employeeuddslink.payudds_ID;
    When I run this it ask for value for employee.Emplid.
    I just want my query to run.  How do I resolve this.
    Regards, Hitesh

    FROM ((employeeuddslink INNER JOIN employee ON employeeuddslink.[employee_ID] =     
    employee.[ID])      INNER JOIN payudds ON employeeuddslink.[payudds_ID] = payudds.[ID]) INNER JOIN data ON                       
       employee.[Emplid]
    In the FROM you have     employee.[ID]     and    employee.[Emplid]   as both being in table [employee].
    Build a little, test a little

  • 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 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

  • How to execute this SQL Query in ABAP Program.

    Hi,
    I have a string which is the SQL Query.
    How to execute this sql Query (SQL_STR) in ABAP Program.
    Code:-
    DATA: SQL_STR type string.
    SQL_STR = 'select * from spfli.'.
    Thanks in Advance,
    Vinay

    Hi Vinay
    Here is a sample to dynamically generate a subroutine-pool having your SQL and calling it.
    REPORT dynamic_sql_example .
    DATA: BEGIN OF gt_itab OCCURS 1 ,
    line(80) TYPE c ,
    END OF gt_itab .
    DATA gt_restab TYPE .... .
    DATA gv_name(30) TYPE c .
    DATA gv_err(120) TYPE c .
    START-OF-SELECTION .
    gt_itab-line = 'REPORT generated_sql .' .
    APPEND gt_itab .
    gt_itab-line = 'FORM exec_sql CHANGING et_table . ' .
    APPEND gt_itab .
    gt_itab-line = SQL_STR .
    APPEND gt_itab .
    gt_itab-line = 'ENDFORM.' .
    APPEND gt_itab .
    GENERATE SUBROUTINE POOL gt_itab NAME gv_name MESSAGE gv_err .
    PERFORM exec_sql IN PROGRAM (gv_name) CHANGING gt_restab
    IF FOUND .
    WRITE:/ gv_err .
    LOOP AT gt_result .
    WRITE:/ .... .
    ENDLOOP .
    *--Serdar

  • How to run the SQL Script in SQL Prompt?

    Hi ExpertGroup,
    I have written one SQL Script name called "MySQLSCript.SQL". I want to know how to run the SQL Script in SQL Prompt?.
    Generally, I run SQL Script in PL/SQL Developer tool. But In this case, some SET command is not working/supporting in PL/SQL Developer Tool.
    Let me know, How to Run in SQl Prompt.
    Thanks & Regards,
    Senthil K Kumar.

    This is my SQL Script....
    SET COLSEP '|'
    SET LINESIZE 32767
    SET PAGESIZE 50000
    /* SET LINESIZE 3000
    SET PAGESIZE 50000
    SET DEFINE OFF */
    SET ECHO OFF
    SET FEEDBACK OFF
    --SET HEADING OFF
    SET TRIMSPOOL ON
    SET NEWPAGE NONE
    SET UNDERLINE OFF
    SPOOL &&EnterPath;
    SELECT * FROM &&TableName;
    SPOOL OFF
    SET FEEDBACK ON
    --SET DEFINE ON
    PROMPT Done.
    I am able to run this script in SQL Prompt....
    Its executing fine...
    But, If I am executing again it maynot asking for new set of data....
    alternativily its taking old values only.....
    how can i exeute with new set of data in the sql prompt.....

  • How to get physical SQL query

    Hi All,
    How to get the physical SQL query for the OBIEE reports.
    Thanks in advance,
    Haree.

    Hi Anitha,
    Thanks for your reply,
    I am getting XML script in log file. (Settings > Administration > Manage Sessions > View Log).
    How to get physical SQL query ?
    Thanks,
    Haree

  • 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 run a search query for a particular folder in KM related to portal

    Hi,
    Can any one tell me the steps for : how to run a search query for a particular folder in knowledge management related to portal.
    Answers will be rewarded.
    Thanks in advance.
    KN
    Edited by: KN on Mar 18, 2008 6:33 AM

    Ok u may not require a coding
    But u req configuration
    U should first make a search option set
    Link: [Search Option set|http://help.sap.com/saphelp_nw04/helpdata/en/cc/f4e77ddef1244380b06fee5f8b892a/frameset.htm]
    Then u need 2 duplicate a KM Command by the name Search From here
    and customize it to include the Search Option that u have created
    Link: [Search from here|http://help.sap.com/saphelp_nw04/helpdata/en/2a/4ff640365d8566e10000000a1550b0/frameset.htm]
    Then in the layout add this command.
    Regards
    BP

  • How Can I find SQL Query in Database

    Dear Experts,
    How Can I find SQL Query in Database.

    Hi,
    U mena what query got executed in db? u can try V$SQL for it.
    Regards
    Bharath

Maybe you are looking for