Question about bad query

Hi all ,
I have small question related to bad query .
what is the affecting happens to database if there is lot of bad query , i know the performance issue is there what's other things .like archive log generated database time , IO , TMP tablespace , please give me information about it's .
thanks & regards.

user11969912 wrote:
I have small question related to bad query . What do you consider a bad query? A bad query can be the result of poorly written and illogical SQL. It can be due to not using bind variables. It can be due to a on-optimal execution plan generated by the CBO. It can be due to poorly designed code that uses what seems to be a "good query", badly and in the wrong way (using bulk collection when a native SQL alone suffices, or hitting the very same data multiple times, etc).
what is the affecting happens to database if there is lot of bad query Each of these have a different impact on the database. A "bad query" can cause a snapshot-too-old error. A deadlock error. A shared pool memory allocation error. Can cause no error and simple increase I/O. Or increase CPU. Etc.
It is a lot more complex than what you seem to think, given your question.

Similar Messages

  • Some question about the query designer

    hello, dear all,
    I am a new comer of here, and I am intersting in BI, but I have no basic knowledge about it.
    so I just want someone could give me some advice about it.
    our boss need I do the developer about the query designer,  I just have searched in this forum. but nothing founded for I am a new comer here,
    I heard there are some training document of the query designer, could someone give me the URL, thanks.

    Hi,
    Query desinger is used to develop a Query, Query can be created on following data targets
    -Info Cube
    -DSO
    Virtual data target
    -MultiCube
    -Infoset
    -Multiprovider
    We have 5 section in query designer
    - Infoprovider : where we select the data target , on which report to be created
    -Filter : to restrict value at infoprovider level ( if you want data for year 2008, for example)
    -Free Characterstic : this allow you to drill down
    -Columns : char/keyfigs to be display in columns can be added here
    Row: key/char to be display in Rows can be added here
    gv me ur mailid i will let u have Bex manual,
    I would suggest , if you have any IDES ( training ) system , where you can log in and then go to RRMX,
    and try to create new query and add any data target ( which is already created ) and then drag and drop the char/key fig to the required section ,
    save it and execute it .....
    if you play arround and see the output , that would help u to understand how to work with query designer.
    Hope this helps
    Sukhi
    Edited by: Sukhvidner Singh on Nov 4, 2009 5:36 PM

  • Question about the Query Optimizer

    For an Excercise during my database lecture the following table
    CREATE TABLE TASKS
        "ID" NUMBER NOT NULL ENABLE,
        "START_DATE" DATE,
        "END_DATE" DATE,
        "DESCRIPTION" VARCHAR2(50 BYTE)
    ) ;with about 1.5 Million Entries were given. In addition there was the following Query:
    SELECT START_DATE, COUNT(START_DATE) FROM TASKS
    GROUP BY START_DATE
    ORDER BY START_DATE;And the Index:
    create index blub on Tasks (start_date asc);The main excercise was to speed up queries with indexes. Because all data is accessed the optimizer ignores the index and just did a full table scan.
    Here the QEP:
    | Id  | Operation          | Name  | Rows  | Bytes | Cost (%CPU)| Time     |                                                                                                                                                                                                                                
    |   0 | SELECT STATEMENT   |       |  9343 | 74744 |  3423   (6)| 00:00:42 |                                                                                                                                                                                                                                
    |   1 |  SORT GROUP BY     |       |  9343 | 74744 |  3423   (6)| 00:00:42 |                                                                                                                                                                                                                                
    |   2 |   TABLE ACCESS FULL| TASKS |  1981K|    15M|  3276   (2)| 00:00:40 |                                                                                                                                                                                                                                
    ----------------------------------------------------------------------------Then we tried to force him to do the index with this query:
    ALTER SESSION SET OPTIMIZER_MODE = FIRST_ROWS_1;
    SELECT /* + INDEX (TASKS BLUB) */ START_DATE, COUNT(START_DATE) FROM TASKS
    GROUP BY START_DATE
    ORDER BY START_DATE;but again it ignored the index. The optimizer guide states clearly, that each time you access all data from a table it has to do a full scan.
    So we tricked him in doing a fast index scan with this query:
    create or replace function bla
    return date deterministic is
      ret date;
    begin
      select MIN(start_date) into ret from Tasks;
      return ret;
    end bla;
    ALTER SESSION SET OPTIMIZER_MODE = FIRST_ROWS_1;
    SELECT /* + INDEX (TASKS BLUB) */ START_DATE, COUNT(START_DATE) FROM TASKS
    where start_date >= bla
    GROUP BY START_DATE
    ORDER BY START_DATE; now we got the following QEP:
    | Id  | Operation            | Name | Rows  | Bytes | Cost (%CPU)| Time     |                                                                                                                                                                                                                               
    |   0 | SELECT STATEMENT     |      |     1 |     8 |     3   (0)| 00:00:01 |                                                                                                                                                                                                                               
    |   1 |  SORT GROUP BY NOSORT|      |     1 |     8 |     3   (0)| 00:00:01 |                                                                                                                                                                                                                               
    |*  2 |   INDEX RANGE SCAN   | BLUB |     1 |     8 |     3   (0)| 00:00:01 |                                                                                                                                                                                                                               
    ----------------------------------------------------------------------------- So it do use the index.
    Now to my two questions:
    1. Why should it always do a full scan (because the optimizer documentation answer is a little bit unsatisfying)?
    2. After looking at the difference between the costs (FS: 3276 IR: 3) and the time the system needs (FS: 9,6 sec IR: 4,45) why does the optimizer refuse the clearly better plan?
    Thanks in advance,
    Kai Gödde
    Edited by: Kai Gödde on May 30, 2011 6:54 PM
    Edited by: Kai Gödde on May 30, 2011 6:56 PM

    John Spencer mentioned already the most important point (the role of NULL values) but here are some minor additions:
    * with the additional NOT NULL condition Oracle will do an INDEX FAST FULL SCAN (a multiblock scan of the index segment, similar to a FULL TABLE SCAN)
    * with the additional NOT NULL condition you don't need a hint and Oracle will choose the IFFS access
    * if the index was a bitmap index you would not need a NOT NULL condition because Oracle stores NULL-values in bitmap indexes (but you should not define bitmap indexes in an OLTP system because they bring massive locking issues)
    * if the index would contain a second value the additional NOT NULL condition would also be needless
    CREATE TABLE TASKS
        "ID" NUMBER NOT NULL ENABLE,
        "START_DATE" DATE,
        "END_DATE" DATE,
        "DESCRIPTION" VARCHAR2(50 BYTE)
    insert into tasks
    select rownum
         , case when mod(rownum, 5) = 0 then null else sysdate - round(rownum/100) end
         , case when mod(rownum, 4) = 0 then null else sysdate - round(rownum/50) end
         , lpad('*', 50 , '*')
      from dual
    connect by level <= 1500000;
    exec dbms_stats.gather_table_stats(user, 'TASKS')
    -- the IFFS access without a hint:
    create index blub on Tasks (start_date);
    SELECT START_DATE
         , COUNT(START_DATE)
      FROM TASKS
    WHERE START_DATE IS NOT NULL
    GROUP BY START_DATE
    ORDER BY START_DATE;
    | Id  | Operation             | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT      |      | 15001 |   102K|  1871  (16)| 00:00:10 |
    |   1 |  SORT GROUP BY        |      | 15001 |   102K|  1871  (16)| 00:00:10 |
    |*  2 |   INDEX FAST FULL SCAN| BLUB |  1200K|  8203K|  1631   (3)| 00:00:09 |
    Statistiken
              0  recursive calls
              0  db block gets
           3198  consistent gets
              0  physical reads
              0  redo size
         378627  bytes sent via SQL*Net to client
          11520  bytes received via SQL*Net from client
           1002  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
          15001  rows processed
    -- the bitmap index
    create bitmap index blub on tasks(START_DATE);
    SELECT START_DATE
         , COUNT(START_DATE)
      FROM TASKS
    GROUP BY START_DATE
    ORDER BY START_DATE
    | Id  | Operation                    | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |      | 15001 |   102K|   132   (1)| 00:00:01 |
    |   1 |  SORT GROUP BY NOSORT        |      | 15001 |   102K|   132   (1)| 00:00:01 |
    |   2 |   BITMAP CONVERSION TO ROWIDS|      |  1500K|    10M|   132   (1)| 00:00:01 |
    |   3 |    BITMAP INDEX FULL SCAN    | BLUB |       |       |            |          |
    Statistiken
              1  recursive calls
              0  db block gets
           1126  consistent gets
              0  physical reads
              0  redo size
         378682  bytes sent via SQL*Net to client
          11520  bytes received via SQL*Net from client
           1002  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
          15002  rows processed
    -- the composite index
    create index blub on tasks(START_DATE, 0);
    SELECT START_DATE
         , COUNT(START_DATE)
      FROM TASKS
    GROUP BY START_DATE
    ORDER BY START_DATE;
    | Id  | Operation             | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT      |      | 15001 |   102K|  2400  (15)| 00:00:12 |
    |   1 |  SORT GROUP BY        |      | 15001 |   102K|  2400  (15)| 00:00:12 |
    |   2 |   INDEX FAST FULL SCAN| BLUB |  1500K|    10M|  2095   (3)| 00:00:11 |
    Statistiken
              0  recursive calls
              0  db block gets
           4120  consistent gets
              0  physical reads
              0  redo size
         378682  bytes sent via SQL*Net to client
          11520  bytes received via SQL*Net from client
           1002  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
          15002  rows processedRegards
    Martin Preiss

  • Question about BADI FI_AUTHORITY_ITEM in ECC 6.0

    Dear all,
    To control the authorizations of users to display the document line items, I have created a Business Add-In Implementation "Z_FI_AUTHORITY_ITEM" with BADI FI_AUTHORITY_ITEM in SAP R/3 4.7.
    The BADI worked correctly in SAP R/3 4.7.
    Recently, we are upgrading my SAP from 4.7 to ECC 6.0. After upgraded, I found that the BADI doesn't called when displaying the documentline item. The status of the BADI is active. I have also tested in debug mode, it seems that it doesn't get into the BADI coding.
    Can I ask how to solve this problem?
    Thanks
    Sunny

    Hi Sunny,
    I hope the following links should be able to answer your questions:
    http://wiki.sdn.sap.com/wiki/display/Snippets/CreatealinkbetweenClassicBAdIandEnhancementspot
    http://www.sapdev.co.uk/enhance/eframework/ef_implicit.htm
    http://blog.csdn.net/conworld/archive/2009/04/01/4040658.aspx
    Regards,
    Warren.

  • Question about Resultant Query

    Documentary Table
    Doc_No     Title     Ranking     YearReleased
    1     Hoop Dreams      A     1994
    2     The Thin Blue Line     B     2000
    3     Surprise Me      A     2004
    4     Trouble the Water      C     2008
    5     Dark Days     B     2000
    6     Paris of Burning     B     1991
    7     Man on Wire     A     2008
    Please tell What will be the resultant relation that will be produced by the following SQL SELECT statement.
    Query:
    SELECT Doc_No, Title, YearReleased
    FROM
    Documentary
    WHERE YearReleased <>‘2000’;
    Please reply

    Ghulam Yassen wrote:
    I am asking about the relation after its output.
    SELECT Doc_No, Title, YearReleased
    FROM
    Documentary
    WHERE YearReleased ‘2000’;What do you mean with relation?
    If you mean the output here you are:
    WITH documentary AS
    SELECT 1 Doc_no, 'Hoop Dreams'        Title, 'A' Ranking, 1994 YearReleased FROM DUAL UNION
    SELECT 2 Doc_no, 'The Thin Blue Line' Title, 'B' Ranking, 2000 YearReleased FROM DUAL UNION
    SELECT 3 Doc_no, 'Surprise Me'        Title, 'A' Ranking, 2004 YearReleased FROM DUAL UNION
    SELECT 4 Doc_no, 'Trouble the Water'  Title, 'C' Ranking, 2008 YearReleased FROM DUAL UNION
    SELECT 5 Doc_no, 'Dark Days'          Title, 'B' Ranking, 2000 YearReleased FROM DUAL UNION
    SELECT 6 Doc_no, 'Paris of Burning'   Title, 'B' Ranking, 1991 YearReleased FROM DUAL UNION
    SELECT 7 Doc_no, 'Man on Wire'        Title, 'A' Ranking, 2008 YearReleased FROM DUAL
    SELECT doc_no, title, yearreleased
      FROM documentary
    WHERE yearreleased {noformat}<{noformat}{noformat}>{noformat} '2000';
        DOC_NO TITLE              YEARRELEASED
             1 Hoop Dreams                1994
             3 Surprise Me                2004
             4 Trouble the Water          2008
             6 Paris of Burning           1991
             7 Man on Wire                2008
    {code}
    Regards.
    Al
    Edited by: Alberto Faenza on Jun 7, 2012 12:54 PM
    Modified to show lt and gt signs                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Question about role query

    Hi all,
    I have created a rolequery and i made it as PUBLIC.
    But when i go to fieldmapping and then selected the rolename radio button and when i tried to see the list in drop down box, i could not see my rolequery.
    Did i miss anything?
    Let me know if you do not understand the question.
    Please help me.
    Thank you.

    Hi,
    In order to be able to select the rolequery in the dropdownlist, you have to create a new role. Preferably you copy an existing role, based on another existing rolwquery and name it like your rolequery.
    When the role is created, add your role query to the role on the workflow routing page of the role. When this is done the role query will appear in the drop down list.
    Kind regards,
    Joris Verdonschot

  • Question about different query results with wildcard

    Hi, I'm working with a third party app on SQL Server 2000, and from what I can gather, programmed in C# & VisualFoxPro.
    When we search with
        Note contains 94949
    we get 571 results, when we search with
        Note contains 94949*
    we get 575 results.
    There should be at least a hundred different entries that start with "94949-1" so I expected the query with the wildcard to return something like 680 results, not an additional four rows.
    Searching with
        Note contains 94949-1*
    got 483 results
        Note contains 94949-10*
    got 0 results
    Could someone explain or point me to more documentation on the difference results we get?
    Thanks

    Hi Arnie, thanks for your response.
    My situation is more basic than what appears in your example. Unfortunately, I am working solely through this application so I do not have access to the SQL to test out what you supplied, so my question is more of a need for an explanation of the search results. I do find lots of references to LIKE, Wildcards and pattern matching, but I don't find a way to explain to the users the best and most complete way to search. They mostly need a "this will always get us the results without missing anything" search technique and then to be able to select from a smaller group. I guess I need a basic course in understanding search results: how to get different ones and what they mean.
    Using 
            Note contains 94949-'%'
    returned one more result than when using an asterisk. I don't understand this difference.
            Note contains 94949-'%1'   or
            Note contains 94949-'1%'
    brings nothing nor does not using quotes. But there are hundreds of records which have the string starting with 94949-1 and a varying number of characters after that.
    ?Does the dash read not as a character in the string but as an expression?
    When I use WITHIN 3 characters, I get too few results (eight). If I use AND, I get text unrelated to the account number I am looking for.
    Again when I tried to narrow the search by adding one digit to the string to be matched, I did not get any results, but 500 results from the more general search is too much to scan by opening individual records.
    Thanks for pondering this with me.

  • Question about WebLogic query syntax

    Hello,
    I am using WebLogic Server 6.0, which came as part of the WebGain
    Studio SE 4.5 development kit. My question regards the Web Logic query
    syntax, which I have not yet mastered.
    I am trying to create a finder method that takes a single argument
    of type "char" and finds all matching fields of the column "keyword" in
    which the argument is the first letter of keyword. That is, if I were
    only looking for fields beginning with the letter "M", I'd use:
    (like keyword 'M%')
    However, I'm looking for all fields beginning with the first letter
    defined by the first argument. Sadly, this syntax:
    (like keyword '$0%')
    doesn't seem to be working. Any suggestions on the correct syntax?
    If this is not the right forum for this question, could someone
    suggest an appropriate newsgroup?
    Thanks, Dave

    962466 wrote:
    Hi all,
    I have an issue I need help with. I have created a script for an automated partition create on a monthly basis. It creates a monthly partition containing all dates within the respective month. The script is essentially this:
    ALTER TABLE SCHEMA.TABLE
    ADD PARTITION &&1
    VALUES LESS THAN (to_number(to_char(to_date('&&2', 'DD-MON-YY'), 'YYYYMMDD')))
    TABLESPACE LARGE_DATA94 COMPRESS;
    I continually get this error message "ORA-14019: partition bound element must be one of: string, datetime or interval literal, number, or MAXVALUE"
    The variable &&2 is passing in character data for the first of the month (E.G. '01-SEP-12'). &&1 passes character data for the month in MONYY (AUG12) I can run this query:
    select
    (to_number(to_char(to_date('&&2', 'DD-MON-YY'), 'YYYYMMDD')))
    from dual;
    With the output of 20120801. I cannot understand why I am able to run this partition create statement by hardcoding 20120901 but passing it in as a variable I receive the error. Note that I am not having problems with the &&1 variable. If anyone has any ideas please let me know. Thanks!I don't understand why you are taking a string, converting it to a date, then converting the date BACK TO a string ... then trying to convert that string to a number.
    What is the data type of the partitioning key? It appears that it is a NUMBER, but actually represents a DATE. If so, that is a fundamentally flawed design.

  • Question about select query.

    Hi,
    i want to insert the result of query to a table,
    all the fields are corresponding except one field.
    is there a way to this or i need to do
    insert ( f1 , f2 ....)
    i did this way
    INTO CORRESPONDING FIELDS OF TABLE It_Return_Date
    but i have another field which i want to insert to table.
    is it possible??
    10X

    lets say you are getting values from a table
    select & into X_TAB1 from TAB1.
    data : x_tab2 type table2.
    x_tab2-newfield = 'new value'. "Populate that new field value
    move corresponding X_TAB1 TO X_TAB2. "all other will copy here
    then use X_TAB2 to insert to your TABLE2.
    INSERT TABLE2 FROM X_TAB2.
    it would be a good practice to use same structure of the table while you use Insert/modify etc.. commands.
    else you can declare TABLES ZTABLE2.
    MOVE CORRESPONDING ZTABLE1 TO ZTABLE2.
    ZTABLE2-NEW_FIELD = <NEW VALUE>.
    then use INSERT.
    INSERT ZTABLE2.
    Regards
    srikanth
    Message was edited by: Srikanth Kidambi

  • Question about infoset query with code

    Hi experts.
    I always appreciate your help. Today, I have some problem. I made infoset query using SQ01 and got some data. Those data include WBS no but some of them didn't. So I tried to put some code into the infoset query that any data has not WBS has some value, for example 'X', in WBS no field.
    I needed to know what field or table I should control to display value 'X' in WBS no field in case that WBS field has no value.
    I tried to put code at "END-OF-SELECTION(before display)" and control %dtab. But I met error message there is no such table %dtab. So, I define %dtab then during runtime, I also met error message %dtab has already been defiend.
    How can I do? Is it impossible thing?? I'm wating for your answer.
    regards.

    Hi, if you just want to fill the field if it is blank, you can do this in the Record Processing Section.
    I'm not familar with the WBS number, so for this example, I will fill the BISMT in MARA during the "Recording Processing" Section.
    if mara-bismt is initial.
    mara-bismt = 'X'.
    endif.
    Regards,
    Rich Heilman

  • Question about caml query with UserID/ parameter (working outside of sharepoint )

    I have to develop a custom view. I should take the current user and query it in List1 to obtain owned group names. Then I am supposed to query each group name in a List2 to obtain corresponding users. And In a new custom list view I should display those users..
    Let's assume I'm working in a c# class in VS. Below is my initial code to fetche owned groups by the current user.
    SPQuery query = new SPQuery();  
    query.ViewFields = @"<FieldRef Name='Title'/>";  
    query.Query = @"<Where><Eq><FieldRef Name='Title' /><Value Type='Integer'><UserID/></Value></Eq></Where>";  
    SPList lstUsers = web.Lists["Users"];  
    SPListItemCollection userItems = lstUsers.GetItems(query);  
    foreach (SPListItem myitem in userItems)  
    {Response.Write(myitem["Title"].ToString());}  
     The "<UserID/>"   parameter in caml query does not work outside...
    query.Query = @"<Where><Eq><FieldRef Name='Title' /><Value Type='Integer'><UserID/></Value></Eq></Where>";
    How can I obtained the current logged user from outside of sharepoint?
    Should I write my code somewhere other then a seperate vs c# class?
    I appreciate any idea and suggestions....

    If you are quering a User ID of UserField, you need to add LookupId='True'/ to FieldRef
    <Eq>
             <FieldRef Name=Owner' LookupId='True'/>
             <Value Type='User' >2</Value>
    </Eq>
    Thanks, Rocky Fernandes

  • Question about hirarchical query

    Hi gurus!
    I have a problem with a hirarchical query. I want to if its possible to query the informations shown in table a and table b in a hierarchical way.
    Table a
    <pre>
    e_id e_num e_name
    1 100 ABC
    2 200 DEF
    </pre>
    Table b
    <pre>
    d_id d_num d_name e_id
    1 300 ABC 1
    2 400 DEF 1
    3 500 GHI 2
    4 600 JKL 2
    </pre>
    The rows should be displayed like this:
    <pre>
    e_id e_num e_name d_id d_num d_name
    1 100 ABC
    1 300 ABC
    2 400 DEF
    2 200 DEF
    3 500 GHI
    4 600 JKL
    </pre>
    Please tell me if this is possible.
    I'm looking forward to your responses.
    yours sincerely
    Florian W.

    Another solution with model
    select  e_id1  ,  e_num1 , e_name1 ,d_id, d_num, d_name
    from (SELECT a.e_id, e_num, e_name, d_id, d_num, d_name
              FROM a, b
              WHERE a.e_id = b.e_id)
    model
    partition by (e_id, e_num, e_name)
    dimension by ( row_number()over(partition by e_id, e_num, e_name order by d_id) rn  )
    measures( e_id e_id1, e_num e_num1, e_name e_name1, d_id, d_num, d_name)
    rules
    upsert
    iterate(100)
    until (presentv(e_id1[iteration_number+2],1,0)=0)
    (e_id1[0]=cv(e_id) ,
    e_num1[0]=cv(e_num),
    e_name1[0]=cv(e_name),
    e_id1[rn>=1] =null,
    e_num1[rn>=1]=null,
    e_name1[rn>=1]=null)
    order by e_id, rn
    SQL> select  e_id1,  e_num1, e_name1,d_id, d_num, d_name
      2  from (SELECT a.e_id, e_num, e_name, d_id, d_num, d_name
      3            FROM a, b
      4            WHERE a.e_id = b.e_id)
      5  model
      6  partition by (e_id, e_num, e_name)
      7  dimension by ( row_number()over(partition by e_id, e_num, e_name order by d_id) rn  )
      8  measures( e_id e_id1, e_num e_num1, e_name e_name1, d_id, d_num, d_name)
      9  rules
    10  upsert
    11  iterate(100)
    12  until (presentv(e_id1[iteration_number+2],1,0)=0)
    13  (e_id1[0]=cv(e_id) ,
    14  e_num1[0]=cv(e_num),
    15  e_name1[0]=cv(e_name),
    16  e_id1[rn>=1] =null,
    17  e_num1[rn>=1]=null,
    18  e_name1[rn>=1]=null)
    19  order by e_id, rn
    20  /
         E_ID1     E_NUM1 E_N       D_ID      D_NUM D_N
             1        100 ABC
                                       1        300 ABC
                                       2        400 DEF
             2        200 DEF
                                       3        500 GHI
                                       4        600 JKL
    6 rows selected.
    SQL>

  • Question about ABAP Query

    Hi,
    I have a SQ01 query .. based on that query i have to call another query
    ie : when my basic list gets diplayed .. after i click on it a detailed list should be displayed (this again is another SQ01 query)... is this possible through abap Query and if it is where am i supposed to code this
    Thanks a lot in advance

    HI
    GOOD
    GO THROUGH THIS LINK
    http://www.ams.utoronto.ca/Asset353.aspx
    THANKS
    MRUTYUN

  • Question about sub query

    Hi friends,
    I have two tables countries ( countries_province varchar2(20) , en_province varchar2 (20))
    - countries_province THE PRIMARY KEY.
    The Other table Victims ( Victims_province varchar2(20) , ..... )
    -Victims_province is a foreign key for countries_province column in counties table .
    I want to show en_province in the following report, but I am getting: subquery retrieves more than one value:
    select Victims_province,
    (select c.en_province from countries c , victims v where c.countries_province = v.Victims_province) as "en_province",
    FROM VICTIMS
    I hope my question is clear ...
    Regards,
    Fateh

    Fateh,
    You are trying to use a "scalar subquery" technique. Frank has shown you a JOIN technique, which I think is the best solution.
    You may still want to know why your statement failed. First, if you run your subquery alone:select c.en_province from countries c , victims v where c.countries_province = v.Victims_provinceyou get every province that is in both tables. You don't want that list in every row, but your subquery is supposed to run once for every row.
    Second, here is a scalar subquery that seems to work:select Victims_province,
    (SELECT C.EN_PROVINCE FROM COUNTRIES C WHERE C.COUNTRIES_PROVINCE = V.VICTIMS_PROVINCE) AS "en_province"
    FROM VICTIMS V;Now the subquery will run once per row, and each time it will look up a different province and return one result.
    Again, this is not the best solution in this context. I just wanted to help you understand the "scalar subquery" technique.

  • Question about Parallel Query

    Currently running Oracle 8.1.7.3 on 32 CPU HP box. I'm doing some data analysis and ran in to some inconsistencies on what columns parallel query works on. For most columns it kicks off all the threads(ora_pxxx) but on a few of the columns, it will only run 1 thread. These queries run full table scans.
    Example SQL:
    Select /* parallel (column1, 10) */ column1
    from table1
    I can't seem to find much documentation on parallel queries.

    sorry. correction on the SQL format:
    Select /*+ parallel(tb1, 20)*/ column1
    from table1 tb1

Maybe you are looking for

  • I need to delete a variable containing a movie clip class and recreate it with a different movie clip class

    Hello, I am creating a program that is going to help students learn to read. In my project are pages of text with each word having a button that when pressed will display a movieclip presentation about that word (its pronounciation and spelling etc..

  • DVD Player Clips & Presentations

    Is there a way to store clips on the hard drive using DVD player? If I had a presentation of many DVDs I used for excerpts, I'd like to have them as files and use those in some way, but it seems like DVD Player doesn't want you to (Fair enough). Will

  • Digital clock which randomly selects different colors from Applet

    Hi, I relatively new to java, what I'm trying to do is list about five colours in my Applet and pass the colours into my java code, and maybe the font..... I want to be able to Display a digital clock which randomly selects different colours which we

  • Grid value is differrent between SO  and DN

    Hi Expert, After dilivery was created by job( program:RVV50R10C) for a SO which was creatd with 2 EA material AAAA (grid value MD), we found the material AAAA in DN was spit to 1 EA MD(batch 50985) and 1EA SM(batch 50984). Actually, there were enough

  • Graphics/Logic board going?

    Hello, My 3 year-old iMac (3.06GHz) has started having issues. It froze up on me the other evening when the screensaver was on. It was an Apple screensaver, not a 3rd party. I had to power down with the button. On restart after chime I get the usual