Select ROLE_TAB_PRIVS as sys and schema_owner return different data; Why?

This code returns seven points of view that are not valid, and therefore not in the role that grants select access to them.



sys@database > select view_name

2 of all_views

3 where owner = "SCHEMA_OWNER."

4 and view_name not in)

5. Select TABLE_NAME

role_tab_privs 6

7 where role = "SELECT_SCHEMA_OWNER")

8.

VIEW_NAME

------------------------------

VIEW001

...

VIEW07

7 selected lines.

sys@database > user conn [schema_owner]

Enter the password:

  1. Connected.

schema_owner@database > select view_name

2 of all_views

3 where owner = ' SCHEMA_OWNER)'

4 and view_name not in)

5. Select TABLE_NAME

role_tab_privs 6

7 where role = "SELECT_SCHEMA_OWNER")

8.

VIEW_NAME

------------------------------

VIEW001

...

VIEW077

77 selected lines.

schema_owner@database >

If a view is invalid, you cannot grant select on it for anything.

I found my answer "Information is provided only on the roles to which the user has access" privileges granted to roles [ROLE_TAB_PRIVS] table

Once I got the role of select_schemaOwner in schemaOwner, the query returns results.  It has to do with the x$ dealios in the role_tab_privs view.

Tags: Database

Similar Questions

  • DatabaseMetaData and ResultSetMetaData return different codes of Type SQL for number

    Hello

    I was testing the code of a colleague who used ResultSetMetaData who was retrieved with Statement.getMetaData () of a select statement. ResultSetMetaData.getColumnType (I) returned 2 (digital) for the SQL type number. My DatabaseMetaData used test code comes from Connection.getMetaData (). DatabaseMetaData.getColumns returned 3 (decimal) for the SQL number type.

    Here is a snippet of code to illustrate the issue:

    The database must contain table MY_TABLE with a column of type "digital."

    String username = "user";

    String password = "password";

    String host = "host".

    Port of String = "port";

    String sid = 'sid ';


    DriverManager.registerDriver (new oracle.jdbc.OracleDriver ());

    Connection connection =

    DriverManager.getConnection ("JDBC: thin: @" + host + ': ' + port + ': ' + sid, user, password);

    Get the SQL with DatabaseMetaData type

    Metadata DatabaseMetaData = connection. getMetaData();

    ResultSet tables is metadata.getTables ( user, null,null, new String [] { "TABLE" });.

    My_table should be the first table

    if (tables. next()) {

    String tableName = table.getString (3);

    log.info (tableName);

    ResultSet columns is metadata.getColumns ( user, tableName,null, null);.

    while (columns. next()) {

    String columnName = columns.getString (4);

    String columnType = columns.getString (5);

    System.out.println (columnName + "' + columnType" ");

    Column type 3

    }

    columns. close();

    }

    tables. close();

    Get the SQL with ResultSetMetaData type

    Statement statement = connection. createStatement();

    String SQL = ' SELECT * FROM my_table ';

    . Perform statement(sql);

    ResultSet resultSet = statement. getResultSet();

    ResultSetMetaData metaData2 = resultSet. getMetaData();

    for (int i = 1; I < = metaData2. getColumnCount(); i++) {

    System.out.println (metaData2.getColumnName (I) + "' .getColumnType metaData2(i) +" ");

    Column type is 2

    }

    Is there a reason for the discrepancy?

    Kind regards

    Johannes

    A bug has been filed for this. You must get your license in any case. ojdbc14 is the obsolete way.

  • RowNumber = 1 return different data

    We are preparing the upgrade to oracle 11g 2 to 12 c.

    We have some test environment to test extracts which is in c 11g 2 and 12.

    Even extract script, the same data, another server with a different version of the database a to 11 g 2, the other is 12 c.

    Most of the snippets returned exactly the same data.

    But for a small number of extracts in .dat file returns a little bit different. We checked into it, it's because the script extracts using a function in the database and it uses rownumber = 1, same order. But another server returns a different record. For example, they return guardian meeting certain criteria, in this case, relatives are Ok, but we wonder why he returned differently. Is there a setting or is there a default sorting of columns in oracle if not specifically using order by?

    Thank you

    Hello

    Oracle does not guarantee that queries would return the same results if used as below.

    Select * from sample_table

    where rownum = 1;

    You may need to use like below to get the same results (Top N queries)

    SELECT column_name, rownum AS rnum

    FROM (SELECT column_name

    OF sample_table

    ORDER BY column_name)

    WHERE rownum<=>

    Kind regards

    Wilson

  • sqlplusw and sqlplus return different characters

    I wonder where the difference in character between sqlplus and sqlplusw. This is the case.
    I have this insert statement. I run it once in sqlplus, once in sqlplusw:
     insert into drop_me (col1) values ('ç');
    The result is quite different:
    PROD@> select dump(col1) from drop_me;
    
    DUMP(COL1)
    ---------------------------------------
    Typ=1 Len=1: 135     => from sqlplus
    Typ=1 Len=1: 231     => from sqlplusw
    Version of the database is 11.2.0.2.0
    Sqlplus version (w) is 10.1.0.4.2
    (but it is reproducible with different versions)
    Database Nls_characterset is WE8MSWIN1252, even as my customer NLS_LANG: AMERICAN_AMERICA. WE8MSWIN1252.

    Sure and characterset of a console window is not 1252, but * 850 * (Please run chcp TBC)
    NLS_LANG must therefore end in. WE8PC850 or you will have problems of conversion.
    Apart from this, sqlplusw is not yet supported more.

    -----------
    Sybrand Bakker
    Senior Oracle DBA

  • TDMS Viewer and excel display different data

    Hello

    I have a problem of reading/viewing my PDM file. My file contains 37 channels and about 7 000 samples per channel. (Just this file... Later, I have to develop on many more ~ 150 k samples per channel)

    Now my problem is: if I open the PDM file with VI TDMS files Viewer, it starts to change the channel after ~ 1000 samples (Channel 29-37(MM1-MM9) should always be-32768, but after 1000 samples, the channel passes their place

    My analysis of switching: after ~ 1000 channels 29-37(MM1-MM9) is the 11-19 after ~ 2000 on 30-1 after ~ 3000 on 12-20, etc...

    Besides the switching channel there is a block of lines ~ 30 only filled every 0 ~ 1000 samples

    But if I open the file in Excel with the PDM-Addin is to show the correct data. Why is this and how to fix the Viewer?

    Hope you understand what I'm trying to say

    I have a my TDMS attached as a ZIP file, could not fix a PDM directly.

    It must be a bug of PDM, not the file viewer component. We will go is studying the issue. Workaround for you call the node "PDM defragment" to defragment this file, then it might appear correctly in the Viewer.

    According to your file, I found that the file has been created by TDMS Advanced knots. You define 10000 samples for an interlaced channel, but you write only 499 samples for a channel in writing. I suggest setting the sample counts exactly acrrording how are going to write.

  • How to select a record in one table to manipulate data in a database?

    Hello community,

    Using 32-bit Labview 2015.

    I created a user interface that runs a query and retrieves my table from a sql database.

    I want to be able to manage only one record at a time by selecting the record in my table and then manipulate the data according to the needs.

    Whenever the user runs a query, I want as the first record in the table to be selected / highlighted.

    I want an indicator that is currently active.

    Then a click of a button, to be able to scroll the actively selected record.

    Once I have the selected record, I want a way to write a query to edit or delete the record.

    Is attached a photo of my query to select all of my table and connect data in my table (results).

    Attached a photo of my painting showing the timeline of my sql database.

    What is the best way to go on a record selection in a table and the modification of data with a query?

    Any help would be greatly appreciated.

    Thank you

    I guess that's not a table, but multi-column listbox.

    Right click, select--> highlight whole line selection Mode

    The value of the multicolumn listbox is the row index - you can write a local variable to highlight the line, the event structure to handle the user clicking on, etc.

    If you enable the property editable ListBox cells, you can allow users to edit the items of the listbox.

    If you want to get the data in row, you hint REF table and work with the array of strings in row - convert it to cluster, etc..

    I don't know, what type of data, it is, how you structure the database looks like, I don't even know if you use the wrapper to work with the database, I can't write queries for you.

    Something like Update Tablica Set Serial = '5' where ID = '22';

  • SQL query return different result 11 GR 1 material and GR 11, 2

    Problem: SQL returns different results in 11 GR 1 material and GR 11, 2 games.

    Example script:

    create the table tab_main
    (
    SOS number (2) not null,
    contract number (2) null
    )
    /

    create the table tab_sub
    (
    number (2) of contract non-null,.
    SOS number (2) null
    )
    /

    insert into tab_main values (1, 10);
    insert into tab_main values (2, 20);
    insert into tab_main values (3, null);
    insert into tab_main values (4, null);

    insert into tab_sub values (1, 10);
    insert into tab_sub (20, 2) values;
    commit;

    The SQL code:

    SELECT *.
    OF tab_main.
    tab_sub
    WHERE tab_main.sos = tab_sub.sos (+) AND
    tab_main. Contract = tab_sub.contract (+) and
    tab_main. Contract not in (select 1 of the double);

    The above query gives more results
    -by 11.2.0.4
    1 10 10 1
    2 20 20 2

    -in 11.1.0.7
    1 10 10 1
    2 20 20 2
    4
    3


    Please tell us what could be the reason for the behaviour of offset lines thie.


    Thank you

    Piesset

    I think it is probably a bug in 11.1.0.7 (and possibly other versions), I get the same results as your 11.2.0.4 9.2.0.7, 10.2.0.3 and 11.2.0.3, and this is the result, I expect.

    Your not in the paragraph is equivalent to:

    SELECT *.

    OF tab_main, tab_sub

    WHERE tab_main.sos = tab_sub.sos (+) AND

    tab_main. Contract = tab_sub.contract (+) and

    tab_main. Contract <> 1;

    Since you have null values in tab_main.contract they are lost by the predicate since null = value is never true (or false).

    John

  • RealTek HD Audio driver "stdriver64.sys" not digitally signed, and update returns the message "everything is up-to-date.

    Hello

    Recently, I checked my RealTek HD Audio drivers and found that the "stdriver64.sys" driver is not digitally signed.  It can be connected to a crash problem that I have known for two weeks now, so I try to update all the drivers and see if it will solve this problem.  When I click on update drivers for RealTek HD Audio, a message returned quickly saying that all drivers are up-to-date.  But again controlled the pilot "stdriver64.sys" shows that it is not digitally signed.  Is there another way to update this driver or another way to take with this?  Thank you for your help.

    Preston

    * original title - RealTek HD Audio driver "stdriver64.sys" not digitally signed and update returns message "everything is up-to-date. How can I solve this? *

    Go to the website of the manufacturer of your computer/laptop > drivers and downloads Section > key in your model number > look for the latest Vista drivers > download/install them.

    See you soon.

    Mick Murphy - Microsoft partner

  • When I use the truncation tool, select a zone and press return it removes everything except for a single pixel. This just started today. CS5, Windows 7.

    When I use the truncation tool, select a zone and press return it removes everything except for a single pixel. This just started today. CS5, Windows 7. I tried to reinstall CS5 and who did not help. I am trying to set up a new computer and installed Photo Shop CS5 on it earlier in the day. Maybe it has something to do with it. But until I get the new fully configured machine I still want to continue to work on my current machine, which is where the problem is happening.

    Hi haroldschlegel,

    Please try resetting the cropping tool

    Restart Photoshop once done and see if that helps.

    Kind regards

    Assani

  • Case to interview several values and unique to different tables return value

    Hi This is my first picture:
    with Table_1
    as
    (
          select 'CAR' Object, 2000 Policy    from dual
          union all
          select 'BIKE' Object, 2000 Policy  from dual
          union all
          select 'HOUSE' Object, 2000 Policy  from dual
          union all
          select 'MOBILE' Object, 2000 Policy  from dual
          union all
          select 'MONEY' Object, 2000 Policy  from dual
          union all
          select 'CREDIT' Object, 2000 Policy  from dual
          union all
          select 'SCOOTER' Object, 2001 Policy    from dual
          union all
          select 'BIKE' Object, 2001 Policy  from dual
          union all
          select 'BEACH' Object, 2001 Policy  from dual
          union all
          select 'HOUSE' Object, 2001 Policy  from dual
          union all
          select 'MONEY' Object, 2001 Policy  from dual
          union all
          select 'CREDIT' Object, 2001 Policy  from dual
          union all
          select 'DOOR' Object, 2002 Policy    from dual
          union all
          select 'BIKE' Object, 2002 Policy  from dual
          union all
          select 'GARDEN' Object, 2002 Policy  from dual
          union all
          select 'MOBILE' Object, 2002 Policy  from dual
          union all
          select 'MONEY' Object, 2002 Policy  from dual
          union all
          select 'CREDIT' Object, 2002 Policy  from dual
          
    )
    select * from Table_1
    I need to query the column object from table_1 for CAR or HOME and if they are present and then returns 'Y' otherwise 'n'. Linking this table_1 to table_2 through politics and the result will be table_3
    with Table_2
    as
    (
          select '21' AGE, 2000 Policy  from dual
          union all
          select '22' AGE, 2001 Policy from dual
          union all
          select '27' AGE, 2002 Policy from dual
          )
    select * from Table_2
    with Table_3
    as
    (
          select '21' AGE, 2000 Policy, 'Y'  Many_Obj    from dual
          union all
          select '22' AGE, 2001 Policy,  'Y' Many_Obj from dual
          union all
          select '27' AGE, 2002 Policy,  'N' Many_Obj from dual
          )
    select * from Table_3
    Thanks in advance

    Banner:
    Oracle Database 11 g Release 11.2.0.2.0 - 64 bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    "CORE 11.2.0.2.0 Production."
    AMT for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    !

    Thanks for the insert statements.
    Here's a way

    with Table_1
    as
    (
          select 'CAR' Object, 2000 Policy    from dual
          union all
          select 'BIKE' Object, 2000 Policy  from dual
          union all
          select 'HOUSE' Object, 2000 Policy  from dual
          union all
          select 'MOBILE' Object, 2000 Policy  from dual
          union all
          select 'MONEY' Object, 2000 Policy  from dual
          union all
          select 'CREDIT' Object, 2000 Policy  from dual
          union all
          select 'SCOOTER' Object, 2001 Policy    from dual
          union all
          select 'BIKE' Object, 2001 Policy  from dual
          union all
          select 'BEACH' Object, 2001 Policy  from dual
          union all
          select 'HOUSE' Object, 2001 Policy  from dual
          union all
          select 'MONEY' Object, 2001 Policy  from dual
          union all
          select 'CREDIT' Object, 2001 Policy  from dual
          union all
          select 'DOOR' Object, 2002 Policy    from dual
          union all
          select 'BIKE' Object, 2002 Policy  from dual
          union all
          select 'GARDEN' Object, 2002 Policy  from dual
          union all
          select 'MOBILE' Object, 2002 Policy  from dual
          union all
          select 'MONEY' Object, 2002 Policy  from dual
          union all
          select 'CREDIT' Object, 2002 Policy  from dual
    
    ),
    Table_2
    as
    (
          select '21' AGE, 2000 Policy  from dual
          union all
          select '22' AGE, 2001 Policy from dual
          union all
          select '27' AGE, 2002 Policy from dual
    )
    SELECT
         age,
         policy,
         Many_Obj
    from
    (
    SELECT
         t2.age,
         t2.policy,
         CASE
              WHEN SUM(
                        CASE
                             WHEN t1.object IN ('CAR','HOUSE')
                             THEN 1
                             ELSE 0
                        END) over( PARTITION BY t2.age,t2.policy) > 0
              THEN 'Y'
              ELSE 'N'
         END Many_Obj,
         row_number() over (PARTITION BY t2.age,t2.policy order by 1) rn
    FROM
         Table_1 t1,
         Table_2 t2
    WHERE
         t1.policy = t2.policy
         )
    where rn = 1;
    
    AGE POLICY                 MANY_OBJ
    --- ---------------------- --------
    21  2000                   Y
    22  2001                   Y
    27  2002                   N        
    

    I advise you to spend the time learning analytical questions and using CASE expressions.

  • Why is password for SYS and SYSTEM different

    I use 10g Express
    During the installation I created the password and I use it as a password with SYS, but it does not work with the SYSTEM

    (I'm with Windows 7 on AMD x 64)

    Thank you.

    Hello

    The SYS and SYSTEM password are asked during the database creation process.

    May be that a different password has been set.

    Anyway, as you know the password for SYS, you can change the password for the SYSTEM with the following statement:

    alter user system identified by ;
    

    Hope this helps.
    Best regards
    Jean Valentine

  • Select with case statement and a formula of the IIR

    Hi, I was looking to get help regarding a statement writing box with a statement select statement all. I tried to reproduce a formula IIf access well that just wanted to check that the query I wrote is correct, any advice would be appreciated.

    [code]

    Select *.

    Of

    (

    Select name, month, duration, volume, time_spent, date1, date2,.

    -case when 'date' > = 'date1' then '1' other '0' end as departure,.

    -case when 'date' < = "date2" then '1' other '0' as end ending

    Of

    (

    Select *.

    of call_1 cd

    inner join call_2 ON cd.name = cl.queue cl

    )

    )

    ;

    [/ code]

    I want to know is where I have my ' select name, etc, I would change that to select * to make it easier instead of typing all the field_names outside, but I don't know how to do and also what follows is 2 IIF formulas from an access database for the start of the final case statements so I just wanted check I wrote it correctly.

    [code]

    departure: IIf ([date] > = [date1], 1, 0)

    [/ code]

    [code]

    ending: IIf ([date] < = [date2], 1, 0)

    [/ code]

    Any advice would be appreciated.

    Hello

    Whenever you have any questions, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
    Explain, using specific examples, how you get these results from these data.

    If the output depends on what anyone outside the application itself (for example, when it is run) and then include a few different examples and the results you want of each given the same sample data. For example, "if I run on November 19, 2013, while the results should be... because... but if I run between November 21 and November 27, then the results should be... because...". »
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

    318f20b8-a3d0-4FB4-bb0f-73785250b7d4 wrote:

    Hi, I was looking to get help regarding a statement writing box with a statement select statement all. I tried to reproduce a formula IIf access well that just wanted to check that the query I wrote is correct, any advice would be appreciated.

    [code]

    Select *.

    Of

    (

    Select name, month, duration, volume, time_spent, date1, date2,.

    -case when 'date' > = 'date1' then '1' other '0' end as departure,.

    -case when "date."<= 'date2'="" then="" '1'="" else="" '0'="" end="" as="">

    Of

    (

    Select *.

    of call_1 cd

    inner join call_2 ON cd.name = cl.queue cl

    )

    )

    ;

    [/ code]

    I want to know is where I have my ' select name, etc, I would change that to select * to make it easier instead of typing all the field_names outside, but I don't know how to do and also what follows is 2 IIF formulas from an access database for the start of the final case statements so I just wanted check I wrote it correctly.

    [code]

    departure: IIf([date]>=[date1],1,0)

    [/ code]

    [code]

    ending: IIf ([date]<>

    [/ code]

    Any advice would be appreciated.

    DATE is not a function of Oracle; in fact, it's a terrible name for a column or function, because it blends with the DATE data type.

    In Oracle, the function SYSDATE returns the date and time, according to the clock on the database server.  So, SYSDATE can return a value as November 19, 2013 06:33:15.   If you want to midnight the same day (i.e., November 19, 2013 00:00:00) and then use TRUNC (SYSDATE).

    String literals (for example the string which consists 5 characters d, a, t, e, and 1) go inside the single quotes. Numbers and the names of columns only.

    If you want to include all the columns, more some calculated values, in a SELECT clause, then you must use a name table or alias before the *.  (See select_2 below.  To do this, assign the alias j to display online.)

    Maybe you wanted to say something like:

    Select *-it's select_1

    de)

    Select j. *-it's select_2

    , case when SYSDATE > = date1 then 1 or 0 end as departure

    , case when SYSDATE<= date2="" then="" 1="" else="" 0="" end="" as="">

    de)

    Select *-it's select_3

    of call_1 cd

    inner join call_2 ON cd.name = cl.queue cl

    ) j

    )

    ;

    As mentioned in a previous answer, you should be careful about the use of "SELECT *" in production code.

    In select_3, it would be better if you explicitly listed the columns you need.  It can improve efficiency and maintenance.  In this request, queue and the name will be always the same, so you probably don't want to include both of them in the result set, in any case.

    In select_1 and select_2, it is acceptable to use "SELECT *", assuming that select_3 is fixed.

    Moreover, there is no point in using subqueries here.  You can get the same results simply in a single query, without any subqueries.

  • How to set up a query - 'A-lines' and 'E' are different.

    Hi all

    I use 11 g R2 and I'm trying to resolve a query. On the execution below plan, my E-lines and my A are different. As you can see, there is little the same line 22 to 43, but starting from line 21 to 1 E-lines are false. For example, on the content (RowSource) 12, E-lines is (1 * 179) and lines A is 8631.

    All statistics have been generated and are up to date. Do you know what could be the problem?
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                                     | Name                      | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  | Writes |  OMem |  1Mem |  O/1/M   | Max-Tmp |
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                              |                           |      1 |        |     50 |00:05:55.08 |     203K|  69975 |   1094 |       |       |          |         |
    |   1 |  SORT ORDER BY                                |                           |      1 |    179 |     50 |00:05:55.08 |     203K|  69975 |   1094 |  8307K|  1133K|          |         |
    |   2 |   HASH UNIQUE                                 |                           |      1 |    179 |   8631 |00:05:54.56 |     203K|  69317 |    180 |  4474K|  1861K|          |   16384 |
    |   3 |    NESTED LOOPS                               |                           |      1 |        |   8631 |00:05:54.04 |     203K|  69137 |      0 |       |       |          |         |
    |   4 |     NESTED LOOPS                              |                           |      1 |    179 |   8631 |00:05:23.24 |     194K|  63768 |      0 |       |       |          |         |
    |   5 |      NESTED LOOPS                             |                           |      1 |    179 |   8631 |00:05:13.51 |     177K|  61396 |      0 |       |       |          |         |
    |   6 |       NESTED LOOPS                            |                           |      1 |    179 |   8631 |00:04:03.74 |     151K|  52928 |      0 |       |       |          |         |
    |   7 |        NESTED LOOPS                           |                           |      1 |    179 |   8631 |00:03:32.15 |     125K|  46425 |      0 |       |       |          |         |
    |*  8 |         HASH JOIN                             |                           |      1 |    179 |   8631 |00:02:59.42 |   99470 |  40095 |      0 |  4379K|  1869K|     1/0/0|         |
    |*  9 |          HASH JOIN                            |                           |      1 |    179 |   8631 |00:02:59.15 |   98919 |  40067 |      0 |   909K|   909K|     1/0/0|         |
    |  10 |           TABLE ACCESS FULL                   | DIM_PERFORMANCE           |      1 |      5 |      5 |00:00:00.01 |       2 |      0 |      0 |       |       |          |         |
    |  11 |           NESTED LOOPS OUTER                  |                           |      1 |    179 |   8631 |00:02:59.06 |   98917 |  40067 |      0 |       |       |          |         |
    |  12 |            NESTED LOOPS                       |                           |      1 |    179 |   8631 |00:02:58.87 |   98917 |  40067 |      0 |       |       |          |         |
    |* 13 |             HASH JOIN                         |                           |      1 |    191 |   8758 |00:00:25.47 |   18101 |   2398 |      0 |  1000K|  1000K|     1/0/0|         |
    |  14 |              TABLE ACCESS FULL                | DIM_TYP_FLUIDE            |      1 |      3 |      3 |00:00:00.01 |       2 |      0 |      0 |       |       |          |         |
    |* 15 |              HASH JOIN                        |                           |      1 |    191 |   8758 |00:00:25.32 |   18099 |   2398 |      0 |   955K|   955K|     1/0/0|         |
    |  16 |               TABLE ACCESS FULL               | DIM_TYP_PDC               |      1 |      3 |      3 |00:00:00.01 |       2 |      0 |      0 |       |       |          |         |
    |  17 |               NESTED LOOPS                    |                           |      1 |        |   8758 |00:00:25.19 |   18097 |   2398 |      0 |       |       |          |         |
    |  18 |                NESTED LOOPS                   |                           |      1 |    191 |   8758 |00:00:06.46 |    9339 |    315 |      0 |       |       |          |         |
    |* 19 |                 HASH JOIN                     |                           |      1 |    191 |   8758 |00:00:00.67 |     565 |      0 |      0 |   880K|   880K|     1/0/0|         |
    |  20 |                  TABLE ACCESS FULL            | DIM_OFFRE                 |      1 |     22 |     22 |00:00:00.01 |       2 |      0 |      0 |       |       |          |         |
    |* 21 |                  HASH JOIN                    |                           |      1 |    191 |   8758 |00:00:00.53 |     563 |      0 |      0 |   779K|   779K|     1/0/0|         |
    |  22 |                   NESTED LOOPS                |                           |      1 |        |      1 |00:00:00.01 |       5 |      0 |      0 |       |       |          |         |
    |  23 |                    NESTED LOOPS               |                           |      1 |      1 |      1 |00:00:00.01 |       4 |      0 |      0 |       |       |          |         |
    |* 24 |                     TABLE ACCESS FULL         | DIM_CONTRAT               |      1 |      1 |      1 |00:00:00.01 |       3 |      0 |      0 |       |       |          |         |
    |* 25 |                     INDEX UNIQUE SCAN         | PK_CONTRACTANT_KEY        |      1 |      1 |      1 |00:00:00.01 |       1 |      0 |      0 |       |       |          |         |
    |* 26 |                    TABLE ACCESS BY INDEX ROWID| DIM_CONTRACTANT           |      1 |      1 |      1 |00:00:00.01 |       1 |      0 |      0 |       |       |          |         |
    |  27 |                   TABLE ACCESS FULL           | REL_SERVICE_POINT_CONTRAT |      1 |  54923 |  54923 |00:00:00.14 |     558 |      0 |      0 |       |       |          |         |
    |* 28 |                 INDEX UNIQUE SCAN             | PK_SP_KEY                 |   8758 |      1 |   8758 |00:00:05.66 |    8774 |    315 |      0 |       |       |          |         |
    |  29 |                TABLE ACCESS BY INDEX ROWID    | DIM_SERVICE_POINT         |   8758 |      1 |   8758 |00:00:18.58 |    8758 |   2083 |      0 |       |       |          |         |
    |  30 |             PARTITION RANGE SINGLE            |                           |   8758 |      1 |   8631 |00:02:33.32 |   80816 |  37669 |      0 |       |       |          |         |
    |* 31 |              TABLE ACCESS BY LOCAL INDEX ROWID| FAC_DAILY_TRANS_PERFORM   |   8758 |      1 |   8631 |00:02:33.18 |   80816 |  37669 |      0 |       |       |          |         |
    |* 32 |               INDEX RANGE SCAN                | IDX3_FAC_DAY_TRAN_PERF    |   8758 |      6 |    103K|00:00:16.05 |   17929 |   4751 |      0 |       |       |          |         |
    |  33 |            TABLE ACCESS BY INDEX ROWID        | DIM_DIAGNOSYS             |   8631 |      1 |      0 |00:00:00.12 |       0 |      0 |      0 |       |       |          |         |
    |* 34 |             INDEX UNIQUE SCAN                 | PK_DIAGNOSYS_KEY          |   8631 |      1 |      0 |00:00:00.05 |       0 |      0 |      0 |       |       |          |         |
    |  35 |          TABLE ACCESS FULL                    | DIM_DATE                  |      1 |  21914 |  21914 |00:00:00.05 |     551 |     28 |      0 |       |       |          |         |
    |  36 |         TABLE ACCESS BY INDEX ROWID           | DIM_RADIO_MODULE          |   8631 |      1 |   8631 |00:00:32.65 |   25895 |   6330 |      0 |       |       |          |         |
    |* 37 |          INDEX UNIQUE SCAN                    | PK_RADMODKEY              |   8631 |      1 |   8631 |00:00:08.38 |   17264 |   2122 |      0 |       |       |          |         |
    |  38 |        TABLE ACCESS BY INDEX ROWID            | DIM_METER_MODULE          |   8631 |      1 |   8631 |00:00:31.51 |   25895 |   6503 |      0 |       |       |          |         |
    |* 39 |         INDEX UNIQUE SCAN                     | PK_METMODKEY              |   8631 |      1 |   8631 |00:00:10.17 |   17264 |   2212 |      0 |       |       |          |         |
    |  40 |       TABLE ACCESS BY INDEX ROWID             | DIM_CUSTOMER              |   8631 |      1 |   8631 |00:01:09.66 |   25895 |   8468 |      0 |       |       |          |         |
    |* 41 |        INDEX UNIQUE SCAN                      | PK_CUSTOMER               |   8631 |      1 |   8631 |00:00:12.03 |   17264 |   2328 |      0 |       |       |          |         |
    |* 42 |      INDEX UNIQUE SCAN                        | PK_METER                  |   8631 |      1 |   8631 |00:00:09.63 |   17264 |   2372 |      0 |       |       |          |         |
    |  43 |     TABLE ACCESS BY INDEX ROWID               | DIM_METER                 |   8631 |      1 |   8631 |00:00:30.71 |    8631 |   5369 |      0 |       |       |          |         |
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    Predicate Information (identified by operation id):
    ---------------------------------------------------
     
       8 - access("T786"."DATE_KEY"="T1830"."DATE_KEY")
       9 - access("T786"."PERFORMANCE_KEY"="T2158"."PERFORMANCE_KEY")
      13 - access("T160"."FLUIDE_KEY"="T210"."FLUIDE_KEY")
      15 - access("T160"."TYP_PDC_KEY"="T217"."TYP_PDC_KEY")
      19 - access("T122"."OFFRE_KEY"="T298"."OFFRE_KEY")
      21 - access("T24"."CONTRAT_KEY"="T298"."CONTRAT_KEY" AND "T17"."CONTRACTANT_KEY"="T298"."CONTRACTANT_KEY")
      24 - filter("T24"."NOM_CONTRAT"='COMMUNAY ET REGION (SIE)')
      25 - access("T17"."CONTRACTANT_KEY"="T24"."CONTRACTANT_KEY")
      26 - filter("T17"."NOM_CONTRACTANT"='ER Rhône Alpes Auvergne')
      28 - access("T160"."SERVICE_POINT_KEY"="T298"."SERVICE_POINT_KEY")
      31 - filter("T786"."REPORTING_DATE"=TO_DATE(' 2013-02-09 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
      32 - access("T160"."SERVICE_POINT_KEY"="T786"."SERVICE_POINT_KEY")
      34 - access("T786"."DIAGNOSYS_KEY"="T2186"."DIAGNOSYS_KEY")
      37 - access("T786"."RADIO_MODULE_KEY"="T949"."RADIO_MODULE_KEY")
      39 - access("T786"."METER_MODULE_KEY"="T1191"."METER_MODULE_KEY")
      41 - access("T786"."CUSTOMER_KEY"="T2098"."CUSTOMER_KEY")
      42 - access("T786"."METER_KEY"="T1011"."METER_KEY")
     
    Also, line 31, my score is used with a local index and E-lines and A-lines are correct, but the index takes 02:33 minutes to get a 8758 ranks who seems to be excessive. EC which could I check/do to reduce it?
    |  30 |             PARTITION RANGE SINGLE            |                           |   8758 |      1 |   8631 |00:02:33.32 |   80816 |  37669 |      0 |       |       |          |         |
    |* 31 |              TABLE ACCESS BY LOCAL INDEX ROWID| FAC_DAILY_TRANS_PERFORM   |   8758 |      1 |   8631 |00:02:33.18 |   80816 |  37669 |      0 |       |       |          |         |
    Thank you very much!

    Hello

    (1) for a significant query, it is rare that the optimizer obtains all right cardinalities
    (2) but normally, it is not really necessary, in most cases just to be in the right ballpark (1-2 orders of magnitude)
    (3) as others already said, the optimizer in your case does that 1 error - in step 1, when evaluating a cardinality of a hash of several columns, the steps join upward simply reproduce this error over and over
    (4) rethink the cardinality of the join is always difficult, and especially when it comes to columns multiple joins because you have several possibilities made a mistake in the selectivity of unique columns, but also because there is a chance that there is a correlation between the columns attached; also, the optimizer uses many settings, called 'mental health controls', which does not make things more simple
    (5) you can try to create statistics on a column in the joined columns group for a more accurate forecast of join cardinality
    (6) there again, get all the cardinalities right does not guarantee that you will get a good plan - for example, you may be limited by the lack of an appropriate index
    (7) sometimes, and more feedback of cardinality (or even instead) it is better to tackle the problem from a different angle: see what operations are ineffective (e.g. rejection lines after spending a lot of e/s on their acquisition), see http://savvinov.com/2013/01/28/efficiency-based-sql-tuning/
    (8) in your case, you have noticed that you: step

    |* 31 |              TABLE ACCESS BY LOCAL INDEX ROWID| FAC_DAILY_TRANS_PERFORM   |   8758 |      1 |   8631 |00:02:33.18 |   80816 |  37669 |      0 |       |       |          |  
    

    is the biggest problem for this plan, even if the cardinality estimate of it's very precise
    (9) you can fix the problem by extending the IDX3_FAC_DAY_TRAN_PERF index to the REPORTING_DATE column: If you do this, then you won't need to 63 k logical reads to return lines k 103 just to reject 90% of them - you will reject them at an earlier stage (INDEX RANGE SCAN) and only need to at most 8 k readings to acquire the filtered lines by table rowid

    Best regards
    Nikolai

  • possible to have a display value and the return of LOV

    Hello

    With the help of obiee 11g, I have a variable prompt that takes column as value.
    I have the report that I use a diff column eual to this prompt value.
    I wanted to know if its possible at all to have a view and a return value
    i.e. in the lov, we show a value and when we choose we choose a different value that goes to the filter

    For example. If we have an APAC region in the table, and then in the show LOV in Asia-Pacific and it returns APAC, so that
    in the data filter gets filtered using ICCA.

    Thank you

    You can try something like this sql in the Prompt Variable:
    SELECT CASE WHEN Office.Region = "ACPA" THEN 'Asia-Pacific' WHERE Office.Region = END 'EMEA' THEN 'EUROPE' TO THE "subject domain name.

    And then in the report so you need to change the column fx filter
    CASE WHEN Office.Region = "ACPA" THEN 'Asia-Pacific' WHERE Office.Region = END 'EMEA' THEN 'EUROPE '.

    Note: This is very good for the case where you have less no.. of LOVs in the column.

    Hope it will be useful...

  • LOV query is not valid, a display and a return value is necessary, column n

    Hello

    I AM FACING
    LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, 
    the first FROM clause in the SQL statement must not belong to the in-line query.
    with two table, I create lov

    the tables are
    CREATE TABLE  "CRM_SALES_DEPARTMENT" 
       (     "DEPT_ID" NUMBER NOT NULL ENABLE, 
         "CUSTOMER_ID" NUMBER NOT NULL ENABLE, 
         "DEPT_CODE" VARCHAR2(50) NOT NULL ENABLE, 
          CONSTRAINT "CRM_SALES_DEPARTMENT_PK" PRIMARY KEY ("DEPT_ID") ENABLE
       )
    CREATE TABLE  "CRM_SALES_CUSTOMERS" 
       (     "ID" NUMBER, 
         "CUSTOMER_NAME" VARCHAR2(255), 
         "CUSTOMER_ADDRESS1" VARCHAR2(255), 
          PRIMARY KEY ("ID") ENABLE
       )
    I USE QUARY
    select (SELECT CS.CUSTOMER_NAME FROM CRM_SALES_CUSTOMERS CS WHERE CS.ID=SD.CUSTOMER_ID) AD D, SD.CUSTOMER_ID R  
    from CRM_SALES_DEPARTMENT SD where SD.DEPT_CODE=:P16_MARKET 
    But who show me LOV query is not valid, a display and a return value is needed, the column names must be
    different. If your query contains a query online, the first CLAUSE in the SQL statement must not belong to the query online.

    How to solve this problem.

    Thank you

    Published by: 805629 on January 10, 2011 03:46

    Published by: 805629 on January 10, 2011 03:58

    Published by: 805629 on January 10, 2011 03:59

    ¿AD?
    Select (SELECTION of CS. CLIENT_NAME CS CRM_SALES_CUSTOMERS WHERE CS.ID = SD. CUSTOMER_ID) AD D, SD. CUSTOMER_ID R
    CRM_SALES_DEPARTMENT SD where SD DEPT_CODE =: P16_MARKET

    But the correct way is a join outher

    select CS.CUSTOMER_NAME D, SD.CUSTOMER_ID R
    from CRM_SALES_CUSTOMERS CS,
            CRM_SALES_DEPARTMENT SD
    where SD.DEPT_CODE=:P16_MARKET
    And CS.ID(+)=SD.CUSTOMER_ID
    

Maybe you are looking for