Complex view
Is it possible to query the IDENTIFIER of a complex view.Hello
user8959784 wrote:
Is it possible to query the IDENTIFIER of a complex view.
You can create a view where a column is the ID of a table in the view. You must give the column an alias.
For example:
CREATE OR REPLACE VIEW view_x
AS
SELECT d.ROWID AS d_rowid
...
FROM scott.dept d
...
Regardless of the complexity of the view is.
Tags: Database
Similar Questions
-
Underlying tables to a complex view
Hi all
I'm trying to find a sql that would help me to list the names of the underlying tables for a set of complex views. Someone at - it a script that I could use - it would save me trying to find/make one.
Thank youTry this
SELECT * FROM all_dependencies WHERE TYPE = 'VIEW' AND owner = '&owner' AND NAME LIKE 'XX_%'
Sandeep Gandhi
-
5 displays perform very well - notice of 5 views running at all
I have 5 'small' views that run very well - they return all the lines (a few hundred to a few thousand) in just a few seconds. They have all the same 3 exact fields that in the view 1 should be the PK if it were a table. View #6 brings together the other 5 on these fields with left join syntax (some points of view have not all possible combinations, while others have multiple matches). Due to the multiple matches in some of the views, the large result set has a fairly high level of duplication in some columns, but we're OK with that.
The problem is that view #6 for all practical purposes does not nothing. He's right there. A small test batch ran for several days before we dropped on it. I know that complex views (views) to honor not always advice but we tried some anyway. parallel and hash join.
Experience to materialise the 5 point view to see return 6 results (and exactly as we want) in a few seconds! Unfortunately we are not allowed to use the materialization without too much red tape option that is not valid. The plan view on display indicates joins to nested loops between the 5 while the materialized view on shows hash joins, so the use of the indicator of hash join attempted nothing helps. But the difference of the join method does not seem to explain it.
We went in a another way of getting the data is attached to the need, but there are some debates and the curiosity to see if it is one approach valid. Everyone knows something like that? Is a view of multiple views, a bad idea?
-
Hi all
Apex 4.0
I created a page (form report) based on a complex view. So when the time to create or update the form it does not allow me: (.)
How pointer or change the form to point to the table instead of the view to 'create' / 'Edit' module?
Thank you very much
KinzKinz,
Can you please create your request on apex.oracle.com and share credentials of the developer with us so that we can see what you're doing?
Cheers, P
-
Hello
I have a simple display object that I use to connect, he questions just the user name and password in the users table.
I have an another display object that uses a query much more complex that retrieves detailed information about this user in different tables.
I have a simple taskflow, a view of the opening of session and a current view, if you log in successfully, you go to the main page.
Now if I use the first view (simple) object to display the username etc then it correctly displays the name of the user who is logged.
If use the other more complicated view opposing it just show the first returned row.
In short, my question is this, if I connect with the object from a point of view, how can I tell the view which line to select another object? I.e. the details of the logged-on user?
I tried to create a link between the objects in view, but which only sort of worked. After that I logged it didn't show the correct line, but after I went to another page that uses the original view object, then he did display the line concerned.
I bet that it would make no sense, but I don't know how else to explain it.
I connect with the view object X.
View object there may not know what line in X, I'm interested.
If I connect X to Y then I have to go to another page in the application X is used in front go understand what line X is on.
Help, please!Looks like your 'Complex' view must have a binding parameter to filter the query of a specific user and your speed of connection must pass this id on the container page.
Discover models of sharing data between regions here:
http://www.Oracle.com/technetwork/TestContent/adfregioninteraction-155145.html -
What is seen composite in oracle?
What is the difference between composite & materialized view?Hello
There is no composite view in the Oracle. This is 100% correct. We have composite primary key, composite index are there. Means more than one column of primary key called composite PK, same more than one column index called composite index. complex view ********** Complex view is a database object which is created by more than one table and with group by functions.(max, min, count,avg,sum). So, we can't perform DML operations on this view. Only Instead of trigger can help you. Ganesh has given the Example of complex view. That is more than enough. Regarding Materialized view, given the URL is enough.
Still, you have any questions...! shoot them.
Concerning
KPR.* If this answer correct then mark as answer.
-
Complex itemRenderer (list in the list), how can I disable scrolling?
Hey people,
so im struggeling for a while with a scrolling problem now.
I'm developing an application flex with a few complex views. On points of view is like a word document view. It extracts data from the database, represents the specification. You can also modify the data in this view "word". Basicially, it should work like microsoft word. This point of view works fine but I have a problem with it: scrolling!
To achieve this point of view, I have created a complex ItemRendererClass that contains another complex ItemRenderClass. Imagine it like this >
-List of chapters (itemrenderer)
-Chapternumber + titrechapitre
-ChapterText
-ChapitreGalerie
-List of data (itemrenderer)
-Requirementnumber
-RequirmeentText
-Photos
-lots and lots of attributes
-...
Overall, I'm really happy about how the view 'word' & editor works but if im scrolling down and im on the second list, which is a list of the requirements I can't scroll more, when the mouse is on the list item, I can scroll again. What I did is use virtuall layout on both lists for performance reasons and the second height of lists is a 100%, so the second wheel never appears. I tried to disable scrolling second of the second list with 'this.scroller.setStyle ('verticalScrollPolicy', 'off'). But nothing happens. I want a normal scrolling behavior, means that it shouldn't matter where, in the 'wordview"mouse is that I want to scroll as if it were a single list and not 2 lists.
I would appreciate a tip where I should look for advice, or maybe someone I the community has faced the same problem.
Thank you
Markus
Thanks for your advice.
I solved the problem in another and for me more easy way.
What I did that I created a skin for the second list. In this skin, I just removed the scroller component. In addition to this, I had assigned the scrolling in the second for the parent of the list component.
Works like a charm so far.
Thank you
Markus
-
Hello
manuals strongly cautioned against the use of complex views in the repository instead of tables - is there a good reason for that - I know it will be higher when you ETL at the tables, but in terms of areas that do not warrant this type of development is all best practices with links between complex views - as I am too often short in errors in the repository when I try.
Thank you
Robert.If you want to use the views (when there is no other way) then the best practice is to use materialized views. It behaves as a concrete table and will not refresh as views are whenever you call display.
-
Hello
Would be happy if someone clarifies the question below.
Oracle version: 10g
1. I created a complex view (say it would return records 10million).
2. this view contains certain structures such as inline view in it (so I guess
in the plan to explain it it can be broken down to the base tables)
2. I use this view in a select as below
Select * from (thisview)
where thisview.empno = 12
and... (a condition more)
In this scenario, my doubt is that would this be to retrieve all the records and filter
It helps the terms specified in the select statement?
Please let us know if some can help me in this regard.
Kind regardsHello
Explain the plan will be the same for inline views. In fact if you use any view it is considered inline seen by Oracle.SQL> select * FROM 2 ( select * from Employees) 3 WHERE first_name='XXX'; no rows selected Execution Plan ---------------------------------------------------------- Plan hash value: 2285394972 ----------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ----------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 68 | 2 (0)| 00:00:01 | | 1 | TABLE ACCESS BY INDEX ROWID| EMPLOYEES | 1 | 68 | 2 (0)| 00:00:01 | |* 2 | INDEX RANGE SCAN | EMP_IDX | 1 | | 1 (0)| 00:00:01 | ----------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - access("EMPLOYEES"."FIRST_NAME"='XXX') Statistics ---------------------------------------------------------- 8 recursive calls 0 db block gets 3 consistent gets 0 physical reads 0 redo size 874 bytes sent via SQL*Net to client 373 bytes received via SQL*Net from client 1 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 0 rows processed SQL>
PS: You can download Oracle and start using it.
http://www.Oracle.com/technology/software/products/database/index.html
Kind regards
Avinash -
ORA-01776: I can not insert a view consisting of two tables
Hello:
I'm doing an insert on a view composed by the join of two tables (services and employees) and it failed.
The view is the following:
CREATE OR REPLACE FORCE VIEW 'EMPDPTO' ('EMPLOYE_ID', 'LAST_NAME', 'EMAIL', 'HIRE_DATE', 'JOB_ID""DEPARTMENT_ID","DEPARTMENT_NAME") AS
(
SELECT employe_id, last_name, email, hire_date, job_id, d.department_id, department_name
E employees, departments d
WHERE e.department_id = d.department_id
);
My insert command
INSERT INTO empdpto
VALUES (743, 'Bermejo', '[email protected]', 12 December 09 ', 'IT_PROG', 10, 'Administration');
get an ORA-01776: it is not possible to modify more than one table of base through a union to join.
On the other side, I saw in the documentation which, in certain circumstances, can do an insert on a complex view.
Is it possible to do an insert on a view consisting of two tables? Under what conditions?
Thank youReference of SQL CREATE VIEW http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_8004.htm#i2065510 views editable Notes section
>
If you want a view of join to be updated, then all of the following conditions must be met:*
The DML must assign only one underlying table of the join.
*An insert, the view does not create WITH CHECK OPTION, and all columns in which the values are inserted must come from a key preserved table. A key-preserved table is one for which each primary key or unique key in the base table value is also unique in the view of the join.
*For an UPDATE statement, the view does not create WITH CHECK OPTION, and all updated columns must be extracted from a preserved key table.
>
The first condition is not true for the view that you created.
Edited by: P. Forstmann on 26 Jan. 2010 20:17
-
I wanted to say that I just started to use the product, and I love it. It covers a lot of ground pretty well. I had a few problems that have been bugging me.
- When selecting between tables (in the relational model), it keeps popping up new properties windows. Is / can he be a setting to simply refresh the Properties window with the data in the new table? A good example would be the way in which the Publisher of the Business Objects universe handles the change of objects (it's written in Java, too).
- When you select tables (in the relational model), it would be great to have the opportunity to find the table object in the open diagram, or to choose from a list of open diagrams. Sorry, I don't like having to use your search engine.
- I have a complex view that I imported that works well in the database. It, unfortunately, breaks your query builder. I get an error "unable to analyze." I can see the SQL code in the window, but should I worry the QB trying to 'fix' my query, or is it simply ignore it (but it will still create installation scripts)?
Thank you.
When you select tables (in the relational model), it would be great to have the opportunity to find the table object in the open diagram, or to choose from a list of open diagrams. Sorry, I don't like having to use your search engine.
Note You can right click on the entry in the Table in the tree view of the browser and select go to diagram > name of the diagram
I have a complex view that I imported that works well in the database. It, unfortunately, breaks your query builder. I get an error "unable to analyze." I can see the SQL code in the window, but should I worry the QB trying to 'fix' my query, or is it simply ignore it (but it will still create installation scripts)?
Although Query Builder, could not analyze the view definition must always appear in the generated DDL script.
David
-
The hierarchy of Concept provides all of the features beyond research opportunities?
All types of specifications contain two fields in "approved for use in": Concept and GSM Business Unit. We have activated the GSM BU security on our 6.1.0.1 facilities and are looking for additional controls between groups of users, workflow (terms), the expansion of the BU values, etc.
I'm trying to estimate if the values of the Concept provide safe behavior control or workflow. So far, I have nothing affecting awareness Concept found a spec to all features except searchable EQT. Y at - it is not its place in PLM4P that the Concept can be used for conditional access / observation of objects spec?
Thank you.It's just a secondary taxonomy, you can use to categorize where your specifications can be used. For example, some clients, you can not think of approved for use by a simple flat list of countries instead of this, they think using a more complex view of the taxonomy.
For example, a customer of catering service can have 3 types of stores. You may designate that a material can be used in the type of restaurant A against coffee.
Your products and how you define where they are licensed to be used will really define this list. You can divide it into all the concepts you want to and even add countries as nodes under them.
This will be tested, but I believe you can also have mixed approaches. A type spec watch concept while the other shows the country.
-
Hi all
I have a question on the front-end of a plugin (12 c).
If I understand correctly, after development of a plug-in with some measures and deployment (i.e. the "backend" built) and it will become visible in the OEM in a UI 'by default' format. If we would give him an interface user custom, it can be developed with Adobe Flash Builder.
Is this correct?
My apologies if this is an obvious question, I'm always mounted on Plug-Ins!
Thank you very much
EdHi Ed,
You are right that EM will provide a simple default view and also for complex views, you must use Flash Builder.
Also, there is a third option, which is to develop a vision only on the (entirely written in XML) metadata. This can be useful if you have a simple view that does not require user interaction. Take a look at the Oracle Enterprise Manager extensibility Programmer's Guide Cloud control (article 8) for more information.
Mike Kelly
Blue Medora Leader extension EM12c
http://bluemedora.com/blog/ -
CONVERSION of BITMAP OF ROWID and IFFS
Hello
A few days ago, I observed the strange behavior of a query that has counted the number of distinct attributes in a single partition of a large table. There is a local bitmap index on the specified column and I assumed that the request would not need to access the table information in the index. Indeed, the query has made an analysis of index full and no access table, but it took more time than I expected (more than 50 seconds in the given case). The sql, followed dbms_sqltune showed me, that most of the work has been associated with the BITMAP ROWID CONVERSION steps and a following GROUP BY of HASH. Then, I changed the query a little and got a much better performance without the BITMAP CONVERSION to ROWID and with a UNIQUE HASH - and operation with the same cost (and the same amount of LIOs). Here's a small suitcase of test 11.2.0.1 showing my remarks (on my Windows PC; "I've seen the effect in a Linux - 11.1.0.7 - data warehouse):
And here are the queries and dbms_sqltune.report_sql_monitor information:drop table t_partitioned; create table t_partitioned ( id number , startdate date , col1 number , padding varchar2(50) ) partition by range(startdate) ( partition t_partitioned_20120522 values less than (to_date('23.05.2012', 'dd.mm.yyyy')) , partition t_partitioned_20120523 values less than (to_date('24.05.2012', 'dd.mm.yyyy')) , partition t_partitioned_maxvalue values less than (maxvalue) ); insert into t_partitioned select rownum id , to_date('22.05.2012', 'dd.mm.yyyy') - 1 + trunc(rownum/500000) startdate , mod(rownum, 4) col1 , lpad('*', 50, '*') padding from dual connect by level <= 1000000; -- executed several times until the table contained 64M rows, i.e. 32M for each day partition. insert into t_partitioned select * from t_partitioned; commit; create bitmap index t_partitioned_col1_start_bix on t_partitioned(col1, startdate) local; exec dbms_stats.gather_table_stats(user, 't_partitioned')
The difference is in the little test 4,09 0.02 sec dry. It seems that slow execution must unpack the bitmaps for the separate number - but I do not understand why it is necessary, given that the number of distinct values is not the ROWID (and indeed the conversion seems to be preventable if I look at the quick plan). And to my surprise the simple query is slower.-- slow query select /*+ monitor test 1 */ count(distinct col1) from t_partitioned where startdate = to_date('22.05.2012', 'dd.mm.yyyy'); -- fast query select /*+ monitor test 2 */ count(*) from (select distinct col1 from t_partitioned where startdate = to_date('22.05.2012', 'dd.mm.yyyy')); -- Test 1 SQL Monitoring Report SQL Text ------------------------------ select /*+ monitor test 1 */ count(distinct col1) from t_partitioned where startdate = to_date('22.05.2012', 'dd.mm.yyyy') Global Information ------------------------------ Status : DONE (ALL ROWS) Instance ID : 1 Session : DBADMIN (67:178) SQL ID : 3mxmz941azrgx SQL Execution ID : 16777216 Execution Started : 05/22/2012 21:48:43 First Refresh Time : 05/22/2012 21:48:43 Last Refresh Time : 05/22/2012 21:48:47 Duration : 4s Module/Action : SQL*Plus/- Service : testdb Program : sqlplus.exe Fetch Calls : 1 Global Stats ================================================================ | Elapsed | Cpu | IO | Fetch | Buffer | Read | Read | | Time(s) | Time(s) | Waits(s) | Calls | Gets | Reqs | Bytes | ================================================================ | 4.09 | 3.54 | 0.55 | 1 | 5868 | 62 | 46MB | ================================================================ SQL Plan Monitoring Details (Plan Hash Value=3761143426) ================================================================================================================================================================================================== | Id | Operation | Name | Rows | Cost | Time | Start | Execs | Rows | Read | Read | Mem | Activity | Activity Detail | | | | | (Estim) | | Active(s) | Active | | (Actual) | Reqs | Bytes | (Max) | (%) | (# samples) | ================================================================================================================================================================================================== | 0 | SELECT STATEMENT | | | | 1 | +4 | 1 | 1 | | | | | | | 1 | SORT AGGREGATE | | 1 | | 1 | +4 | 1 | 1 | | | | | | | 2 | VIEW | VW_DAG_0 | 2602 | 5361 | 1 | +4 | 1 | 4 | | | | | | | 3 | HASH GROUP BY | | 2602 | 5361 | 4 | +1 | 1 | 4 | | | 840K | 50.00 | Cpu (2) | | 4 | PARTITION RANGE SINGLE | | 2602 | 5360 | 3 | +2 | 1 | 32M | | | | | | | 5 | BITMAP CONVERSION TO ROWIDS | | 2602 | 5360 | 3 | +2 | 1 | 32M | | | | 25.00 | Cpu (1) | | 6 | BITMAP INDEX FAST FULL SCAN | T_PARTITIONED_COL1_START_BIX | | | 3 | +2 | 1 | 5836 | 62 | 46MB | | 25.00 | db file scattered read (1) | ================================================================================================================================================================================================== -- Test 2 SQL Monitoring Report SQL Text ------------------------------ select /*+ monitor test 2 */ count(*) from (select distinct col1 from t_partitioned where startdate = to_date('22.05.2012', 'dd.mm.yyyy')) Global Information ------------------------------ Status : DONE (ALL ROWS) Instance ID : 1 Session : DBADMIN (67:178) SQL ID : 512z4htdq43cn SQL Execution ID : 16777216 Execution Started : 05/22/2012 21:48:49 First Refresh Time : 05/22/2012 21:48:49 Last Refresh Time : 05/22/2012 21:48:49 Duration : .019299s Module/Action : SQL*Plus/- Service : testdb Program : sqlplus.exe Fetch Calls : 1 Global Stats ================================================= | Elapsed | Cpu | Other | Fetch | Buffer | | Time(s) | Time(s) | Waits(s) | Calls | Gets | ================================================= | 0.02 | 0.02 | 0.00 | 1 | 5868 | ================================================= SQL Plan Monitoring Details (Plan Hash Value=4286208786) ======================================================================================================================================================================= | Id | Operation | Name | Rows | Cost | Time | Start | Execs | Rows | Mem | Activity | Activity Detail | | | | | (Estim) | | Active(s) | Active | | (Actual) | (Max) | (%) | (# samples) | ======================================================================================================================================================================= | 0 | SELECT STATEMENT | | | | 1 | +0 | 1 | 1 | | | | | 1 | SORT AGGREGATE | | 1 | | 1 | +0 | 1 | 1 | | | | | 2 | VIEW | | 2602 | 5361 | 1 | +0 | 1 | 4 | | | | | 3 | HASH UNIQUE | | 2602 | 5361 | 1 | +0 | 1 | 4 | 840K | | | | 4 | PARTITION RANGE SINGLE | | 2602 | 5360 | 1 | +0 | 1 | 5836 | | | | | 5 | BITMAP INDEX FAST FULL SCAN | T_PARTITIONED_COL1_START_BIX | 2602 | 5360 | 1 | +0 | 1 | 5836 | | | | =======================================================================================================================================================================
I also did a trace of cbo (10053) but I don't see a good reason for the difference in behavior here:
So slow execution consider still more possible transformations - but obviously not the one fitting.-- fast execution ************************** Query transformations (QT) ************************** CBQT: Validity checks passed for 8kj3uttv3nt4j. CSE: Considering common sub-expression elimination in query block SEL$1 (#0) ... Final query after transformations:******* UNPARSED QUERY IS ******* SELECT COUNT(*) "COUNT(*)" FROM (SELECT DISTINCT "T_PARTITIONED"."COL1" "COL1" FROM "DBADMIN"."T_PARTITIONED" "T_PARTITIONED" WHERE "T_PARTITIONED"."STARTDATE"=TO_DATE(' 2012-05-22 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) "from$_subquery$_001" -- slow execution ************************** Query transformations (QT) ************************** JF: Checking validity of join factorization for query block SEL$1 (#0) JF: Bypassed: not a UNION or UNION-ALL query block. ST: not valid since star transformation parameter is FALSE TE: Checking validity of table expansion for query block SEL$1 (#0) TE: Bypassed: No relevant table found. CBQT bypassed for query block SEL$1 (#0): no complex view, sub-queries or UNION (ALL) queries. CBQT: Validity checks failed for d0471pgnw27nc. CSE: Considering common sub-expression elimination in query block SEL$1 (#0) ... Final query after transformations:******* UNPARSED QUERY IS ******* SELECT COUNT("VW_DAG_0"."ITEM_1") "COUNT(DISTINCTCOL1)" FROM (SELECT "T_PARTITIONED"."COL1" "ITEM_1" FROM "DBADMIN"."T_PARTITIONED" "T_PARTITIONED" WHERE "T_PARTITIONED"."STARTDATE"=TO_DATE(' 2012-05-22 00:00:00', 'syyyy-mm-dd hh24:mi:ss') GROUP BY "T_PARTITIONED"."COL1") "VW_DAG_0"
The question is: I do not miss a semantic difference between the two queries and is there a good reason why the CBO does not have the transformation of the slow to the fast version?
Concerning
Martin Preissmpreiss wrote:
================================================================================================================================================================================================== | Id | Operation | Name | Rows | Cost | Time | Start | Execs | Rows | Read | Read | Mem | Activity | Activity Detail | | | | | (Estim) | | Active(s) | Active | | (Actual) | Reqs | Bytes | (Max) | (%) | (# samples) | ================================================================================================================================================================================================== | 0 | SELECT STATEMENT | | | | 1 | +4 | 1 | 1 | | | | | | | 1 | SORT AGGREGATE | | 1 | | 1 | +4 | 1 | 1 | | | | | | | 2 | VIEW | VW_DAG_0 | 2602 | 5361 | 1 | +4 | 1 | 4 | | | | | | | 3 | HASH GROUP BY | | 2602 | 5361 | 4 | +1 | 1 | 4 | | | 840K | 50.00 | Cpu (2) | | 4 | PARTITION RANGE SINGLE | | 2602 | 5360 | 3 | +2 | 1 | 32M | | | | | | | 5 | BITMAP CONVERSION TO ROWIDS | | 2602 | 5360 | 3 | +2 | 1 | 32M | | | | 25.00 | Cpu (1) | | 6 | BITMAP INDEX FAST FULL SCAN | T_PARTITIONED_COL1_START_BIX | | | 3 | +2 | 1 | 5836 | 62 | 46MB | | 25.00 | db file scattered read (1) | ==================================================================================================================================================================================================
Martin,
I think it's just one of those things where the code for the optimizer is not uniform in all cases. I first met this anomaly with a query with a subquery IN a few years ago:
select dim.* from dim where id in ( select distinct status from area_sales ) ;
If the breast to a view query online, but is not converted to a semi-join, so you see the same effect. This request is a little weird (it's a business model of the customer). Here is the list rows in a dimension table (with PK) which lies in the fact (with bitmap index) table.
--------------------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | OMem | 1Mem | Used-Mem | --------------------------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | 6 |00:00:00.01 | 29 | | | | |* 1 | HASH JOIN | | 1 | 6 | 6 |00:00:00.01 | 29 | 1594K| 1594K| 865K (0)| | 2 | VIEW | VW_NSO_1 | 1 | 6 | 6 |00:00:00.01 | 21 | | | | | 3 | HASH UNIQUE | | 1 | 6 | 6 |00:00:00.01 | 21 | 1595K| 1595K| 715K (0)| | 4 | BITMAP CONVERSION TO ROWIDS | | 1 | 100K| 100K|00:00:00.01 | 21 | | | | | 5 | BITMAP INDEX FAST FULL SCAN| AS_BI | 1 | | 30 |00:00:00.01 | 21 | | | | | 6 | TABLE ACCESS FULL | DIM | 1 | 6 | 6 |00:00:00.01 | 8 | | | | ---------------------------------------------------------------------------------------------------------------------------------
The conversion does not occur if you rewrite the manual unnesting query:
select dim.* from ( select distinct status from area_sales ) sttv,I dim where dim.id = sttv.status ;
The strange thing is the 10053 trace shows that this manual rewrite is (apparently) exactly the thing that is well optimized.
In the latest versions of Oracle, plans are lots of volumes and distribution - I saw half a dozen plans different for the same query through three different versions of Oracle.(In fact, you can see something similar, many queries with subquery costs where the subquery is involved in-the cost of the query automatically to the often seems to be slightly higher than the cost of the subquery manually to the when the manual and automatic plans are the same (otherwise)).
This really expected to have nothing to do with NULL values, moreover, because the bitmap indexes contain a string of NULL values.
Concerning
Jonathan Lewis -
selection of multiple grants on the same object
Hello
(The following SQl code will be run on 9i, 10g and 11g database versions)
Im trying to produce a list of the directory of the subsidies that are the same from 2 different users (but only display the details of a user grants)
to clarify...
lets say we have 100 directories and 2 users who have granted permissions on them, user A and user B.
Permissions can be granted on a directory by just A user, to any user B or the same permission granted on the same directory by users A and B.
I want to make a list that displays the details of the directories where user A and user B are granted this permission (but in the list only display the details of A user grants)
If the following SQL code will give me all the directory permissions that are granted by user A
Select p.table_name, p.grantee, p.owner, p.grantor, p.privilege, o.object_type
of dba_tab_privs p
dba_objects o inner join
on o.object_name = p.table_name
where o.object_type = 'DIRECTORY '.
and p.grantor = 'USER ';
so I want to make the same list of grants by USERA just, but only if these directories have also been granted the same permission by USERB
any ideas on the best way to do it?
Thank you882817 wrote:
What's the advantage I have this solution on the previous?Well, I just introduced two solutions. Depending on the particular case compare you execution plans and choose a better. Here we have quite complex views, but I would say the analytical solution is a little bit faster:
SQL> explain plan for 2 select p.table_name, 3 p.grantee, 4 p.owner, 5 p.grantor, 6 p.privilege, 7 o.object_type 8 from dba_tab_privs p 9 inner join 10 dba_objects o 11 on ( 12 o.object_type = 'DIRECTORY' 13 and 14 o.owner = p.owner 15 and 16 o.object_name = p.table_name 17 and 18 p.grantor != 'U2' 19 ) 20 where not exists ( 21 select 1 22 from dba_tab_privs p1 23 where p.owner = p1.owner 24 and p.table_name = p1.table_name 25 and p.grantee = p1.grantee 26 and p.privilege = p1.privilege 27 and p1.grantor = 'U2' 28* ) SQL> / Explained. SQL> @?\rdbms\admin\utlxpls PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ Plan hash value: 1557554763 ---------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | ---------------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 494 | 131K| | 864 (5)| 00:00:11 | |* 1 | HASH JOIN | | 494 | 131K| | 864 (5)| 00:00:11 | |* 2 | TABLE ACCESS FULL | USER$ | 73 | 1095 | | 3 (0)| 00:00:01 | |* 3 | HASH JOIN ANTI | | 494 | 124K| | 861 (5)| 00:00:11 | |* 4 | HASH JOIN | | 522 | 96570 | | 681 (5)| 00:00:09 | | 5 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ |* 6 | HASH JOIN | | 522 | 88740 | | 678 (5)| 00:00:09 | | 7 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 8 | HASH JOIN | | 38597 | 5842K| 1752K| 674 (5)| 00:00:09 | |* 9 | HASH JOIN | | 24484 | 1458K| | 172 (5)| 00:00:03 | |* 10 | HASH JOIN | | 24221 | 685K| | 23 (9)| 00:00:01 | | 11 | INDEX FULL SCAN | I_TABLE_PRIVILEGE_MAP | 24 | 240 | | 1 (0)| 00:00:01 | |* 12 | TABLE ACCESS FULL | OBJAUTH$ | 24221 | 449K| | 21 (5)| 00:00:01 | | 13 | TABLE ACCESS FULL | OBJ$ | 52647 | 1645K| | 147 (3)| 00:00:02 | | 14 | VIEW | DBA_OBJECTS | 49670 | 4559K| | 164 (10)| 00:00:02 | | 15 | UNION-ALL | | | | | | | |* 16 | FILTER | | | | | | | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ |* 17 | HASH JOIN | | 52627 | 2826K| | 162 (10)| 00:00:02 | | 18 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 19 | TABLE ACCESS FULL | OBJ$ | 52627 | 2055K| | 158 (9)| 00:00:02 | |* 20 | TABLE ACCESS BY INDEX ROWID | IND$ | 1 | 8 | | 2 (0)| 00:00:01 | |* 21 | INDEX UNIQUE SCAN | I_IND1 | 1 | | | 1 (0)| 00:00:01 | |* 22 | TABLE ACCESS BY INDEX ROWID| SUM$ | 1 | 8 | | 1 (0)| 00:00:01 | |* 23 | INDEX UNIQUE SCAN | I_SUM$_1 | 1 | | | 0 (0)| 00:00:01 | |* 24 | FILTER | | | | | | | |* 25 | HASH JOIN | | 9 | 513 | | 5 (20)| 00:00:01 | | 26 | INDEX FULL SCAN | I_LINK1 | 9 | 378 | | 1 (0)| 00:00:01 | | 27 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ | 28 | VIEW | VW_SQ_1 | 1530 | 109K| | 179 (4)| 00:00:03 | |* 29 | HASH JOIN | | 1530 | 158K| | 179 (4)| 00:00:03 | | 30 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 31 | HASH JOIN | | 1530 | 135K| | 176 (4)| 00:00:03 | |* 32 | HASH JOIN | | 1514 | 89326 | | 27 (8)| 00:00:01 | | 33 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 34 | HASH JOIN | | 1514 | 66616 | | 24 (9)| 00:00:01 | | 35 | INDEX FULL SCAN | I_TABLE_PRIVILEGE_MAP | 24 | 240 | | 1 (0)| 00:00:01 | | 36 | NESTED LOOPS | | 1514 | 51476 | | 22 (5)| 00:00:01 | | 37 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 15 | | 1 (0)| 00:00:01 | |* 38 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| 00:00:01 | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ |* 39 | TABLE ACCESS FULL | OBJAUTH$ | 1514 | 28766 | | 21 (5)| 00:00:01 | | 40 | TABLE ACCESS FULL | OBJ$ | 52647 | 1645K| | 147 (3)| 00:00:02 | ---------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - access("OA"."GRANTOR#"="UR"."USER#") 2 - filter("UR"."NAME"<>'U2') 3 - access("U"."NAME"="NAME" AND "O"."NAME"="NAME" AND "UE"."NAME"="NAME" AND "TPM"."NAME"="NAME") 4 - access("OA"."GRANTEE#"="UE"."USER#") PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ 6 - access("O"."OWNER"="U"."NAME" AND "U"."USER#"="O"."OWNER#") 8 - access("O"."OBJECT_NAME"="O"."NAME") 9 - access("OA"."OBJ#"="O"."OBJ#") 10 - access("OA"."PRIVILEGE#"="TPM"."PRIVILEGE") 12 - filter("OA"."COL#" IS NULL) 16 - filter(("O"."TYPE#"<>1 AND "O"."TYPE#"<>10 OR "O"."TYPE#"=1 AND (SELECT 1 FROM "SYS"."IND$" "I" WHERE "I"."OBJ#"=:B1 AND ("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR "I"."TYPE#"=6 OR "I"."TYPE#"=7 OR "I"."TYPE#"=9))=1) AND DECODE("O"."TYPE#",0,'NEXT OBJECT',1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6,'SEQUENCE',7,'PROCEDURE',8,'FUNCTION',9,'PACKAG E',11,'PACKAGE BODY',12,'TRIGGER',13,'TYPE',14,'TYPE BODY',19,'TABLE PARTITION',20,'INDEX PARTITION',21,'LOB',22,'LIBRARY',23,'DIRECTORY',24,'QUEUE',28,'JAVA SOURCE',29,'JAVA CLASS',30,'JAVA PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ RESOURCE',32,'INDEXTYPE',33,'OPERATOR',34,'TABLE SUBPARTITION',35,'INDEX SUBPARTITION',40,'LOB PARTITION',41,'LOB SUBPARTITION',42,NVL( (SELECT DISTINCT 'REWRITE EQUIVALENCE' FROM SYS."SUM$" "S" WHERE "S"."OBJ#"=:B2 AND BITAND("S"."XPFLAGS",8388608)=8388608),'MATERIALIZED VIEW'),43,'DIMENSION',44,'CONTEXT',46,'RULE SET',47,'RESOURCE PLAN',48,'CONSUMER GROUP',51,'SUBSCRIPTION',52,'LOCATION',55,'XML SCHEMA',56,'JAVA DATA',57,'SECURITY PROFILE',59,'RULE',60,'CAPTURE',61,'APPLY',62,'EVALUATION CONTEXT',66,'JOB',67,'PROGRAM',68,'JOB CLASS',69,'WINDOW',72,'WINDOW GROUP',74,'SCHEDULE',79,'CHAIN',81,'FILE GROUP','UNDEFINED')='DIRECTORY') 17 - access("O"."OWNER#"="U"."USER#") 19 - filter("O"."LINKNAME" IS NULL AND "O"."NAME"<>'_NEXT_OBJECT' AND "O"."NAME"<>'_default_auditing_options_' AND BITAND("O"."FLAGS",128)=0) 20 - filter("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR "I"."TYPE#"=6 OR PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ "I"."TYPE#"=7 OR "I"."TYPE#"=9) 21 - access("I"."OBJ#"=:B1) 22 - filter(BITAND("S"."XPFLAGS",8388608)=8388608) 23 - access("S"."OBJ#"=:B1) 24 - filter(NULL IS NOT NULL) 25 - access("L"."OWNER#"="U"."USER#") 29 - access("U"."USER#"="O"."OWNER#") 31 - access("OA"."OBJ#"="O"."OBJ#") 32 - access("OA"."GRANTEE#"="UE"."USER#") 34 - access("OA"."PRIVILEGE#"="TPM"."PRIVILEGE") 38 - access("UR"."NAME"='U2') PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ 39 - filter("OA"."COL#" IS NULL AND "OA"."GRANTOR#"="UR"."USER#") 89 rows selected. SQL> explain plan for 2 select table_name, 3 grantee, 4 owner, 5 grantor, 6 privilege, 7 object_type 8 from ( 9 select p.table_name, 10 p.grantee, 11 p.owner, 12 p.grantor, 13 p.privilege, 14 o.object_type, 15 count(case when p.grantor != 'U2' then 1 end) over(partition by p.table_name,p.grantee,p.owner,p.privilege) u2_indicator 16 from dba_tab_privs p 17 inner join 18 dba_objects o 19 on ( 20 o.object_type = 'DIRECTORY' 21 and 22 o.owner = p.owner 23 and 24 o.object_name = p.table_name 25 ) 26 ) 27 where u2_indicator = 1 28 / Explained. SQL> SQL> SQL> @?\rdbms\admin\utlxpls PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ Plan hash value: 1974693759 ------------------------------------------------------------------------------------------------------------------------ | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | ------------------------------------------------------------------------------------------------------------------------ | 0 | SELECT STATEMENT | | 522 | 59508 | | 674 (5)| 00:00:09 | |* 1 | VIEW | | 522 | 59508 | | 674 (5)| 00:00:09 | | 2 | WINDOW SORT | | 522 | 101K| | 674 (5)| 00:00:09 | |* 3 | HASH JOIN | | 522 | 101K| | 673 (5)| 00:00:09 | | 4 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 5 | HASH JOIN | | 522 | 96570 | | 670 (5)| 00:00:09 | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ | 6 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 7 | HASH JOIN | | 522 | 88740 | | 666 (5)| 00:00:08 | | 8 | INDEX FULL SCAN | I_TABLE_PRIVILEGE_MAP | 24 | 240 | | 1 (0)| 00:00:01 | |* 9 | HASH JOIN | | 522 | 83520 | | 665 (5)| 00:00:08 | | 10 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 11 | HASH JOIN | | 38597 | 5465K| 1512K| 661 (4)| 00:00:08 | |* 12 | HASH JOIN | | 24484 | 1219K| | 170 (4)| 00:00:03 | |* 13 | TABLE ACCESS FULL | OBJAUTH$ | 24221 | 449K| | 21 (5)| 00:00:01 | | 14 | TABLE ACCESS FULL | OBJ$ | 52647 | 1645K| | 147 (3)| 00:00:02 | | 15 | VIEW | DBA_OBJECTS | 49670 | 4559K| | 164 (10)| 00:00:02 | | 16 | UNION-ALL | | | | | | | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ |* 17 | FILTER | | | | | | | |* 18 | HASH JOIN | | 52627 | 2826K| | 162 (10)| 00:00:02 | | 19 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 20 | TABLE ACCESS FULL | OBJ$ | 52627 | 2055K| | 158 (9)| 00:00:02 | |* 21 | TABLE ACCESS BY INDEX ROWID | IND$ | 1 | 8 | | 2 (0)| 00:00:01 | |* 22 | INDEX UNIQUE SCAN | I_IND1 | 1 | | | 1 (0)| 00:00:01 | |* 23 | TABLE ACCESS BY INDEX ROWID| SUM$ | 1 | 8 | | 1 (0)| 00:00:01 | |* 24 | INDEX UNIQUE SCAN | I_SUM$_1 | 1 | | | 0 (0)| 00:00:01 | |* 25 | FILTER | | | | | | | |* 26 | HASH JOIN | | 9 | 513 | | 5 (20)| 00:00:01 | | 27 | INDEX FULL SCAN | I_LINK1 | 9 | 378 | | 1 (0)| 00:00:01 | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ | 28 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | ------------------------------------------------------------------------------------------------------------------------ Predicate Information (identified by operation id): --------------------------------------------------- 1 - filter("U2_INDICATOR"=1) 3 - access("OA"."GRANTEE#"="UE"."USER#") 5 - access("OA"."GRANTOR#"="UR"."USER#") 7 - access("OA"."PRIVILEGE#"="TPM"."PRIVILEGE") 9 - access("O"."OWNER"="U"."NAME" AND "U"."USER#"="O"."OWNER#") PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ 11 - access("O"."OBJECT_NAME"="O"."NAME") 12 - access("OA"."OBJ#"="O"."OBJ#") 13 - filter("OA"."COL#" IS NULL) 17 - filter(("O"."TYPE#"<>1 AND "O"."TYPE#"<>10 OR "O"."TYPE#"=1 AND (SELECT 1 FROM "SYS"."IND$" "I" WHERE "I"."OBJ#"=:B1 AND ("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR "I"."TYPE#"=6 OR "I"."TYPE#"=7 OR "I"."TYPE#"=9))=1) AND DECODE("O"."TYPE#",0,'NEXT OBJECT',1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6,'SEQUENCE',7,'PROCEDURE',8,'FUNCTION',9,'PACKAGE' ,11,'PACKAGE BODY',12,'TRIGGER',13,'TYPE',14,'TYPE BODY',19,'TABLE PARTITION',20,'INDEX PARTITION',21,'LOB',22,'LIBRARY',23,'DIRECTORY',24,'QUEUE',28,'JAVA SOURCE',29,'JAVA CLASS',30,'JAVA RESOURCE',32,'INDEXTYPE',33,'OPERATOR',34,'TABLE SUBPARTITION',35,'INDEX SUBPARTITION',40,'LOB PARTITION',41,'LOB SUBPARTITION',42,NVL( (SELECT DISTINCT 'REWRITE EQUIVALENCE' FROM SYS."SUM$" "S" WHERE PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ "S"."OBJ#"=:B2 AND BITAND("S"."XPFLAGS",8388608)=8388608),'MATERIALIZED VIEW'),43,'DIMENSION',44,'CONTEXT',46,'RULE SET',47,'RESOURCE PLAN',48,'CONSUMER GROUP',51,'SUBSCRIPTION',52,'LOCATION',55,'XML SCHEMA',56,'JAVA DATA',57,'SECURITY PROFILE',59,'RULE',60,'CAPTURE',61,'APPLY',62,'EVALUATION CONTEXT',66,'JOB',67,'PROGRAM',68,'JOB CLASS',69,'WINDOW',72,'WINDOW GROUP',74,'SCHEDULE',79,'CHAIN',81,'FILE GROUP','UNDEFINED')='DIRECTORY') 18 - access("O"."OWNER#"="U"."USER#") 20 - filter("O"."LINKNAME" IS NULL AND "O"."NAME"<>'_NEXT_OBJECT' AND "O"."NAME"<>'_default_auditing_options_' AND BITAND("O"."FLAGS",128)=0) 21 - filter("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR "I"."TYPE#"=6 OR "I"."TYPE#"=7 OR "I"."TYPE#"=9) 22 - access("I"."OBJ#"=:B1) PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ 23 - filter(BITAND("S"."XPFLAGS",8388608)=8388608) 24 - access("S"."OBJ#"=:B1) 25 - filter(NULL IS NOT NULL) 26 - access("L"."OWNER#"="U"."USER#") 70 rows selected. SQL>
SY.
Maybe you are looking for
-
Impossible to delete cookies for individual Web sites
Turn Firefox 29 8.1 on windows 64-bit. This arose because a particular Web site difficulties to set a cookie (I think) - FF gave the error that the site Web server was redirect the request in a way that could not be completed-, but with a warning tha
-
I am trying to print photos and print-wash
I am trying to print photos on photo paper on a HP Photosmart 7510 - C311a e-all-in-one printer and they print washed out. I changed on the new ink cartridges.
-
DHCP and IOS AnyConnect/WebVPN
I've had a good look and can't seem to find the documentation referring to the ability to use DHCP to distribute addresses for the clients of AnyConnect using IOS, only pools defined on the router. Someone at - it an external DHCP Server distributing
-
When I try to delete the remaining files, I get error 0 x 80004002
Original title: error 0 x 80004002 I just uninstalled the free NITRo pdf Reader worm, however I still see running. When I try to delete the remaining files, I get the above message, Help, please. Thank you Mr. Zaid has S has
-
VMware vCloud Director with the NSX Manager installation process.
Hello worldI recently planned to deploy VMware vCloud Director (so NSX Manager will be deployed, as part of the process) on an existing environment (existing virtual machines running, virtual switches,...).Customers use their virtual machines because